From 7a58e397a9323476fcea5d1556b4996e474dc15e Mon Sep 17 00:00:00 2001 From: Fabian Henneke Date: Fri, 11 Sep 2020 09:58:03 +0200 Subject: Disable SSH multiplexing if not supported (#1093) Co-authored-by: Harsh Shandilya --- .../com/zeapo/pwdstore/git/operation/PullOperation.kt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/src/main/java/com/zeapo/pwdstore/git/operation') 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> = 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"), ) } -- cgit v1.2.3