commit cb49e6afccbde6f035f65c453d22b3be99576f82 from: Stefan Sperling date: Wed Aug 14 10:13:03 2019 UTC add notes about how pull/push could work commit - e8022e04f7356894bc356e9e163b21c3b13eac16 commit + cb49e6afccbde6f035f65c453d22b3be99576f82 blob - /dev/null blob + c10d5e6264c75df03c644efb23d168ff94feed11 (mode 644) --- /dev/null +++ notes-pull-push @@ -0,0 +1,70 @@ +All this is assuming operation against a custom gotd(8) server which +would queue up incoming commits and run a 'trivial-rebase' operation +for each commit in sequence. + +'trivial-rebase' merges trees successfully as long as all file content +changes apply to the expected 'base blob' content (which implies a +conflict-free file merge according to diff3), all added blobs get +added where no blob exists yet, and only existing blobs get deleted. + +--- + +got pull: + + fetch latest master branch from server to local origin/master + origin/master has new commits + if fast-forward possible: + set master -> origin/master + if running in a worktree: { + if fast-forward was possible: + user may now run 'got update' + else: + attempt server-style trivial-rebase of master onto origin/master + if success: + set work tree's branch to rebased master branch (implied got up -b) + else: + require manual rebase + resolve conflicts + } else: + existing worktrees will have to be updated/rebased manually + +--- + +got push: + + attempt push + trivial-rebase on server + out-of-date ? -> require 'got pull' + +--- + +"push by default" commit (default for master branch and other important +branches on central server): + +got checkout + +work work work + +got commit + create temp commit object; attempt push + trivial-rebase on server + if success: + temp commit becomes new head of local master + optionally, user may run 'got pull' to rebase local version of master + else + require got pull + try to commit again + +--- + +repo/gotconfig syntax ideas: + +remote "openbsd" server ssh://got.openbsd.org user stsp +remote "my_mirror" server ssh://got.stsp.name user stsp +remote "my_mirror_anonssh" server ssh://got.stsp.name user anonymous +remote "my_mirror_https" server https://got.stsp.name # no auth creds, read-only + +branch master pull-from my_mirror_anonssh sync-to openbsd +# "sync-to" -> push by default with 'got commit' +# implied mapping: refs/heads/master <-> refs/remotes/openbsd/master + +branch my_branch pull-from my_mirror_anonssh push-to my_mirror +# "push-to" -> commit locally, push manually +# implied mapping: refs/heads/my_branch <-> refs/remotes/my_mirror/my_branch