From 848bc87d3fcc0d33cd29a9dd4541dbe6d6b44352 Mon Sep 17 00:00:00 2001 From: Mohamed Date: Thu, 15 Jun 2017 14:08:16 +0200 Subject: fix files not being committed --- app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 6 +++--- app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java | 3 ++- app/src/main/java/com/zeapo/pwdstore/git/SyncOperation.java | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index 4fb21428..2fe1cf10 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -573,13 +573,13 @@ public class PasswordStore extends AppCompatActivity { public void execute(boolean finishOnEnd) { Log.d(TAG, "Commiting with message " + message); Git git = new Git(this.repository); - GitAsyncTask tasks = new GitAsyncTask(activity, false, true, this); + GitAsyncTask tasks = new GitAsyncTask(activity, finishOnEnd, true, this); tasks.execute( git.add().addFilepattern("."), - git.commit().setMessage(message) + git.commit().setAll(true).setMessage(message) ); } - }.execute(true); + }.execute(false); } protected void onActivityResult(int requestCode, int resultCode, diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java index ad93b2ce..fa323bf4 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java @@ -64,7 +64,8 @@ public class GitAsyncTask extends AsyncTask { try { if (command instanceof StatusCommand) { // in case we have changes, we want to keep track of it - nbChanges = ((StatusCommand) command).call().getChanged().size(); + org.eclipse.jgit.api.Status status = ((StatusCommand) command).call(); + nbChanges = status.getChanged().size() + status.getMissing().size(); } else if (command instanceof CommitCommand) { // the previous status will eventually be used to avoid a commit if (nbChanges == null || nbChanges > 0) diff --git a/app/src/main/java/com/zeapo/pwdstore/git/SyncOperation.java b/app/src/main/java/com/zeapo/pwdstore/git/SyncOperation.java index 128713e9..21e59e61 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/SyncOperation.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/SyncOperation.java @@ -41,7 +41,7 @@ public class SyncOperation extends GitOperation { Git git = new Git(repository); this.addCommand = git.add().addFilepattern("."); this.statusCommand = git.status(); - this.commitCommand = git.commit().setMessage("[Android Password Store] Sync"); + this.commitCommand = git.commit().setAll(true).setMessage("[Android Password Store] Sync"); this.pullCommand = git.pull().setRebase(true).setRemote("origin"); this.pushCommand = git.push().setPushAll().setRemote("origin"); return this; -- cgit v1.2.3