uprava gitAdd
This commit is contained in:
38
js/model.js
38
js/model.js
@@ -77,12 +77,18 @@ class Model {
|
||||
return statList;
|
||||
}
|
||||
|
||||
async getChangedFiles(dirTree, statTree) {
|
||||
async getChangedFiles() {
|
||||
this.chFiles = await this.changedFiles(this.dirTree, this.gitDirTreeStat);
|
||||
|
||||
return this.chFiles;
|
||||
}
|
||||
|
||||
async changedFiles(dirTree, statTree) {
|
||||
var changedFiles = [];
|
||||
|
||||
for (let i = 1; i < dirTree.length; i++) {
|
||||
if (Array.isArray(dirTree[i])) {
|
||||
var vnorena = await this.getChangedFiles(dirTree[i], statTree[i]);
|
||||
var vnorena = await this.changedFiles(dirTree[i], statTree[i]);
|
||||
if (vnorena.length != 0) {
|
||||
for (let i = 0; i < vnorena.length; i++) {
|
||||
changedFiles.push(vnorena[i]);
|
||||
@@ -116,6 +122,8 @@ class Model {
|
||||
delete window.fs;
|
||||
window.fs = new LightningFS("fs", { wipe: true });
|
||||
await this.getDirTree();
|
||||
|
||||
localStorage.setItem("pushError", "false")
|
||||
}
|
||||
|
||||
async cloneRep() {
|
||||
@@ -169,6 +177,32 @@ class Model {
|
||||
});
|
||||
}
|
||||
|
||||
async gitAdd() {
|
||||
let filesToAdd = this.chFiles;
|
||||
|
||||
for (let i = 0; i < filesToAdd.length; i++) {
|
||||
console.log(filesToAdd[i])
|
||||
await git.add({
|
||||
fs,
|
||||
dir,
|
||||
filepath: filesToAdd[i].substring(1),
|
||||
});
|
||||
}
|
||||
/* for (let i = 1; i < dirTree.length; i++) {
|
||||
if (Array.isArray(dirTree[i])) {
|
||||
await this.gitAddAll(dirTree[i]);
|
||||
} else {
|
||||
await git.add({
|
||||
fs,
|
||||
dir,
|
||||
filepath: dirTree[0].substring(1) + dirTree[i],
|
||||
});
|
||||
console.log(dirTree[0].substring(1) + dirTree[i]);
|
||||
}
|
||||
} */
|
||||
|
||||
}
|
||||
|
||||
async gitCommit(msg) {
|
||||
await git.commit({
|
||||
fs,
|
||||
|
||||
Reference in New Issue
Block a user