diff options
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/PullOperation.java')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/PullOperation.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/PullOperation.java b/app/src/main/java/com/zeapo/pwdstore/git/PullOperation.java new file mode 100644 index 00000000..abf4bfe6 --- /dev/null +++ b/app/src/main/java/com/zeapo/pwdstore/git/PullOperation.java @@ -0,0 +1,41 @@ +package com.zeapo.pwdstore.git; + +import android.app.Activity; + +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.PullCommand; + +import java.io.File; + +public class PullOperation extends GitOperation { + + /** + * Creates a new git operation + * + * @param fileDir the git working tree directory + * @param callingActivity the calling activity + */ + public PullOperation(File fileDir, Activity callingActivity) { + super(fileDir, callingActivity); + } + + /** + * Sets the command + * @return the current object + */ + public PullOperation setCommand() { + this.command = new Git(repository) + .pull() + .setRebase(true) + .setRemote("origin"); + return this; + } + + @Override + public void execute() throws Exception { + if (this.provider != null) { + ((PullCommand) this.command).setCredentialsProvider(this.provider); + } + new GitAsyncTask(callingActivity, true, false, PullCommand.class).execute(this.command); + } +} |
