propigateAdjustedCommits in seekExportContent

push: When on an adjusted branch, propagate changes to parent branch before
updating export remotes.

This is a somewhat redundant call to propigateAdjustedCommits, since it
also gets called at pushLocal time. That other one needs to come after
importing from importtree remotes though, and seekExportContent has to come
earlier, so I don't see a way to avoid doing it twice.

Note that git-annex sync also manages to avoid the problem, it's only
git-annex push that had the bug.

Sponsored-by: Leon Schuermann on Patreon
This commit is contained in:
Joey Hess 2023-09-11 14:54:26 -04:00
parent aeaadb8eb8
commit 7be8950138
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 44 additions and 3 deletions

View file

@ -979,7 +979,17 @@ syncFile o ebloom rs af k = do
- Returns True if any file transfers were made.
-}
seekExportContent :: Maybe SyncOptions -> [Remote] -> CurrBranch -> Annex Bool
seekExportContent o rs (currbranch, _) = or <$> forM rs go
seekExportContent o rs (mcurrbranch, madj)
| null rs = return False
| otherwise = do
-- Propigate commits from the adjusted branch, so that
-- when the remoteAnnexTrackingBranch is set to the parent
-- branch, it will be up-to-date.
case (mcurrbranch, madj) of
(Just currbranch, Just adj) ->
propigateAdjustedCommits currbranch adj
_ -> noop
or <$> forM rs go
where
go r
| maybe False (\o' -> operationMode o' == SatisfyMode) o =
@ -1000,7 +1010,7 @@ seekExportContent o rs (currbranch, _) = or <$> forM rs go
Nothing -> id
mcurrtree <- maybe (pure Nothing)
(inRepo . Git.Ref.tree . addsubdir)
currbranch
mcurrbranch
mtbcommitsha <- Command.Export.getExportCommit r b
case (mtree, mcurrtree, mtbcommitsha) of
(Just tree, Just currtree, Just _)
@ -1021,7 +1031,7 @@ seekExportContent o rs (currbranch, _) = or <$> forM rs go
cannotupdateexport r db mreason showwarning = do
exported <- getExport (Remote.uuid r)
when showwarning $
maybe noop (warncannotupdateexport r mreason exported) currbranch
maybe noop (warncannotupdateexport r mreason exported) mcurrbranch
fillexistingexport r db (exportedTreeishes exported) Nothing
warncannotupdateexport r mreason exported currb = case mreason of