aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java
diff options
context:
space:
mode:
authorMohamed Zenadi <zeapo@users.noreply.github.com>2019-05-15 11:22:07 +0200
committerGitHub <noreply@github.com>2019-05-15 11:22:07 +0200
commit064a3fad99d5852d50634a98023cb92c4a915606 (patch)
treed99160440eed728662d588d547e7b05f5ebe749d /app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java
parent127a8b8c8a10d9c93bfc7e91e94b4bcb252eddeb (diff)
downloadHardenedPass-064a3fad99d5852d50634a98023cb92c4a915606.tar.gz
HardenedPass-064a3fad99d5852d50634a98023cb92c4a915606.zip
Allow the user to push local master to a new branch in case of conflict (#508)
* detect that we're in a detached head and show the message * add a new way to clean local repo in case of failed rebase
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java11
1 files changed, 11 insertions, 0 deletions
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 79234a32..52f5b1b7 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitAsyncTask.java
@@ -8,7 +8,10 @@ import com.zeapo.pwdstore.PasswordStore;
import com.zeapo.pwdstore.R;
import org.eclipse.jgit.api.CommitCommand;
import org.eclipse.jgit.api.GitCommand;
+import org.eclipse.jgit.api.PullCommand;
+import org.eclipse.jgit.api.PullResult;
import org.eclipse.jgit.api.PushCommand;
+import org.eclipse.jgit.api.RebaseResult;
import org.eclipse.jgit.api.StatusCommand;
import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.RemoteRefUpdate;
@@ -50,6 +53,14 @@ public class GitAsyncTask extends AsyncTask<GitCommand, Integer, String> {
// the previous status will eventually be used to avoid a commit
if (nbChanges == null || nbChanges > 0)
command.call();
+ } else if (command instanceof PullCommand) {
+ final PullResult result = ((PullCommand) command).call();
+ final RebaseResult rr = result.getRebaseResult();
+
+ if (rr.getStatus() == RebaseResult.Status.STOPPED) {
+ return activity.getString(R.string.git_pull_fail_error);
+ }
+
} else if (command instanceof PushCommand) {
for (final PushResult result : ((PushCommand) command).call()) {
// Code imported (modified) from Gerrit PushOp, license Apache v2