diff --git a/Assistant/Threads/Exporter.hs b/Assistant/Threads/Exporter.hs index 747e919da7..6a43954bcb 100644 --- a/Assistant/Threads/Exporter.hs +++ b/Assistant/Threads/Exporter.hs @@ -64,6 +64,7 @@ exportToRemotes rs = do Annex.changeState $ \st -> st { Annex.errcounter = 0 } start <- liftIO getCurrentTime void $ Command.Sync.seekExportContent rs + =<< join Command.Sync.getCurrBranch -- Look at command error counter to see if the export -- didn't work. failed <- (> 0) <$> Annex.getState Annex.errcounter diff --git a/CHANGELOG b/CHANGELOG index 51e6590f51..5b7221e9d4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +git-annex (6.20180927) UNRELEASED; urgency=medium + + * sync: Warn when a remote's export is not updated to the current + tree because export tracking is not configured. + + -- Joey Hess Thu, 27 Sep 2018 15:27:20 -0400 + git-annex (6.20180926) upstream; urgency=medium [ Joey Hess ] diff --git a/Command/Sync.hs b/Command/Sync.hs index 52fa929ee8..39187ed939 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -189,7 +189,7 @@ seek o = allowConcurrentOutput $ do whenM shouldsynccontent $ do syncedcontent <- seekSyncContent o dataremotes - exportedcontent <- seekExportContent exportremotes + exportedcontent <- withbranch $ seekExportContent exportremotes -- Transferring content can take a while, -- and other changes can be pushed to the -- git-annex branch on the remotes in the @@ -680,22 +680,39 @@ syncFile ebloom rs af k = onlyActionOn' k $ do - - Returns True if any file transfers were made. -} -seekExportContent :: [Remote] -> Annex Bool -seekExportContent rs = or <$> forM rs go +seekExportContent :: [Remote] -> CurrBranch -> Annex Bool +seekExportContent rs (currbranch, _) = or <$> forM rs go where go r = withExclusiveLock (gitAnnexExportLock (Remote.uuid r)) $ do db <- Export.openDb (Remote.uuid r) ea <- Remote.exportActions r exported <- case remoteAnnexExportTracking (Remote.gitconfig r) of - Nothing -> getExport (Remote.uuid r) + Nothing -> nontracking r Just b -> do mcur <- inRepo $ Git.Ref.tree b case mcur of - Nothing -> getExport (Remote.uuid r) + Nothing -> nontracking r Just cur -> do Command.Export.changeExport r ea db cur return [Exported cur []] Export.closeDb db `after` fillexport r ea db exported + + nontracking r = do + exported <- getExport (Remote.uuid r) + maybe noop (warnnontracking r exported) currbranch + return exported + + warnnontracking r exported currb = inRepo (Git.Ref.tree currb) >>= \case + Just currt | not (any (\ex -> exportedTreeish ex == currt) exported) -> + showLongNote $ unwords + [ "Not updating export to " ++ Remote.name r + , "to reflect changes to the tree, because export" + , "tracking is not enabled. " + , "(Use git-annex export's --tracking option" + , "to enable it.)" + ] + _ -> noop + fillexport _ _ _ [] = return False fillexport r ea db (Exported { exportedTreeish = t }:[]) = diff --git a/doc/git-annex-export.mdwn b/doc/git-annex-export.mdwn index 95f56e024b..6c963990b3 100644 --- a/doc/git-annex-export.mdwn +++ b/doc/git-annex-export.mdwn @@ -43,7 +43,7 @@ versions of files stored in them. If a special remote is set up to do that, it can be used as a key/value store and the limitations in the above paragraph do not appy. Note that dropping content from such a remote is not supported. See individual special remotes' documentation for -details of how to enable such versioning. +details of how to enable such versioning. # OPTIONS @@ -55,7 +55,11 @@ details of how to enable such versioning. This makes the export track changes that are committed to the branch. `git annex sync --content` and the git-annex assistant - will update exports when it commits to the branch they are tracking. + will update exports with commits made to the branch. + + This is a local configuration setting, similar to a git remote's tracking + branch. You'll need to run `git annex export --tracking` in each + repository you want the export to track. * `--fast` diff --git a/doc/todo/sync_to_non_tracking_export_confusing.mdwn b/doc/todo/sync_to_non_tracking_export_confusing.mdwn index 3a4bfe6255..2f67fed5d8 100644 --- a/doc/todo/sync_to_non_tracking_export_confusing.mdwn +++ b/doc/todo/sync_to_non_tracking_export_confusing.mdwn @@ -17,3 +17,5 @@ have a tracking branch, to help the user understand why it's not syncing their recent changes to it. --[[Joey]] + +> [[done]] --[[Joey]]