push synced/master before synced/git-annex
sync: Partly work around github behavior that first branch to be pushed to a new repository is assumed to be the head branch, by not pushing synced/git-annex first. github expects master (or whatever the name is) to be pushed first, but git-annex sync can't, because it's got to also support pushes to non-bare repos where pushing master fails, as explained in the big comment. So pushing synced/master is not entirely a fix, but at least it makes github default to a branch with the stuff the user expects in it, not a bunch of annex log files. Aside from fixing github to not make this assumption, or improving the git push protocol to include what the current HEAD is, the only other approach I can think of is to identify git push's progress messages and display those when pushing master, while filtering out error messages about non-fast-forward etc. But git doesn't provide a way to separate out or identify its progress messages. Sponsored-by: Luke Shumaker on Patreon
This commit is contained in:
parent
fcd5c6a21c
commit
1cc7b2661e
3 changed files with 26 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
|||
git-annex (8.20210622) UNRELEASED; urgency=medium
|
||||
|
||||
* sync: Partly work around github behavior that first branch to be pushed
|
||||
to a new repository is assumed to be the head branch, by not pushing
|
||||
synced/git-annex first.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Mon, 21 Jun 2021 12:25:25 -0400
|
||||
|
||||
git-annex (8.20210621) upstream; urgency=medium
|
||||
|
||||
* New matching options --excludesamecontent and --includesamecontent
|
||||
|
|
|
@ -604,8 +604,15 @@ pushRemote o remote (Just branch, _) = do
|
|||
- direct push is tried, with stderr discarded, to update the branch ref
|
||||
- on the remote.
|
||||
-
|
||||
- The sync push forces the update of the remote synced/git-annex branch.
|
||||
- This is necessary if a transition has rewritten the git-annex branch.
|
||||
- The sync push first sends the synced/master branch,
|
||||
- and then forces the update of the remote synced/git-annex branch.
|
||||
-
|
||||
- Since some providers like github may treat the first branch sent
|
||||
- as the default branch, it's better to make that be synced/master than
|
||||
- synced/git-annex. (Although neither is ideal, it's the best that
|
||||
- can be managed given the constraints on order.)
|
||||
-
|
||||
- The forcing is necessary if a transition has rewritten the git-annex branch.
|
||||
- Normally any changes to the git-annex branch get pulled and merged before
|
||||
- this push, so this forcing is unlikely to overwrite new data pushed
|
||||
- in from another repository that is also syncing.
|
||||
|
@ -618,8 +625,8 @@ pushBranch :: Remote -> Maybe Git.Branch -> Git.Repo -> IO Bool
|
|||
pushBranch remote mbranch g = directpush `after` annexpush `after` syncpush
|
||||
where
|
||||
syncpush = flip Git.Command.runBool g $ pushparams $ catMaybes
|
||||
[ Just $ Git.Branch.forcePush $ refspec Annex.Branch.name
|
||||
, (refspec . fromAdjustedBranch) <$> mbranch
|
||||
[ (refspec . fromAdjustedBranch) <$> mbranch
|
||||
, Just $ Git.Branch.forcePush $ refspec Annex.Branch.name
|
||||
]
|
||||
annexpush = void $ tryIO $ flip Git.Command.runQuiet g $ pushparams
|
||||
[ Git.fromRef $ Git.Ref.base $ Annex.Branch.name ]
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 11"""
|
||||
date="2021-06-21T16:25:13Z"
|
||||
content="""
|
||||
Changed the sync order as I discussed.
|
||||
"""]]
|
Loading…
Reference in a new issue