uprava gitAdd

master
David Zálešák 4 years ago
parent 641c58e419
commit fa92f12f78

@ -241,7 +241,7 @@ class Controller {
}
loading.style.display = "block";
this.model.gitAddAll().then(
this.model.gitAdd().then(
function (value) {
this.model.gitCommit(msg.value).then(
function (value) {
@ -261,12 +261,10 @@ class Controller {
}
openPublish() {
this.model
.getChangedFiles(this.model.dirTree, this.model.gitDirTreeStat)
.then(
function (v) {
this.view.openPublish(v);
}.bind(this)
);
this.model.getChangedFiles().then(
function (v) {
this.view.openPublish(v);
}.bind(this)
);
}
}

@ -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,