diff options
| author | Fabian Henneke <FabianHenneke@users.noreply.github.com> | 2020-09-11 09:58:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-11 13:28:03 +0530 |
| commit | 7a58e397a9323476fcea5d1556b4996e474dc15e (patch) | |
| tree | 797359ddeaf81094e3ad8eea8736bf672e39ad91 /app/src/main/java/com/zeapo/pwdstore/git/operation | |
| parent | 9cb8551a90c10b22ef1c81ffcf00a84e1d9144f9 (diff) | |
| download | HardenedPass-7a58e397a9323476fcea5d1556b4996e474dc15e.tar.gz HardenedPass-7a58e397a9323476fcea5d1556b4996e474dc15e.zip | |
Disable SSH multiplexing if not supported (#1093)
Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/operation')
| -rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/operation/PullOperation.kt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/operation/PullOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/operation/PullOperation.kt index d4ce6d01..8173105c 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/operation/PullOperation.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/operation/PullOperation.kt @@ -9,7 +9,23 @@ import org.eclipse.jgit.api.GitCommand class PullOperation(callingActivity: AppCompatActivity) : GitOperation(callingActivity) { + /** + * The story of why the pull operation is committing files goes like this: Once upon a time when + * the world was burning and Blade Runner 2049 was real life (in the worst way), we were made + * aware that Bitbucket is actually bad, and disables a neat OpenSSH feature called multiplexing. + * So now, rather than being able to do a [SyncOperation], we'd have to first do a [PullOperation] + * and then a [PushOperation]. To make the behavior identical despite this suboptimal situation, + * we opted to replicate [SyncOperation]'s committing flow within [PullOperation], almost exactly + * replicating [SyncOperation] but leaving the pushing part to [PushOperation]. + */ override val commands: Array<GitCommand<out Any>> = arrayOf( + // Stage all files + git.add().addFilepattern("."), + // Populate the changed files count + git.status(), + // Commit everything! If needed, obviously. + git.commit().setAll(true).setMessage("[Android Password Store] Sync"), + // Pull and rebase on top of the remote branch git.pull().setRebase(true).setRemote("origin"), ) } |
