sync, assistant: Include repository name in head branch commit message.

Note that while the assistant detects changes made to remote names, I left
the commit message fixed rather than calculating it after every commit. It
doesn't seem worth the CPU to do the latter.
This commit is contained in:
Joey Hess 2015-02-11 13:33:55 -04:00
parent 07eec0b396
commit f5b830e07c
5 changed files with 33 additions and 6 deletions

View file

@ -12,6 +12,7 @@ module Command.Sync (
mergeLocal,
mergeRemote,
commitStaged,
commitMsg,
pushBranch,
updateBranch,
syncBranch,
@ -41,10 +42,12 @@ import qualified Command.Move
import Logs.Location
import Annex.Drop
import Annex.UUID
import Logs.UUID
import Annex.AutoMerge
import Annex.Ssh
import Control.Concurrent.MVar
import qualified Data.Map as M
cmd :: [Command]
cmd = [withOptions syncOptions $
@ -145,8 +148,8 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted )
commit :: CommandStart
commit = next $ next $ do
commitmessage <- fromMaybe "git-annex automatic sync"
<$> Annex.getField (optionName messageOption)
commitmessage <- maybe commitMsg return
=<< Annex.getField (optionName messageOption)
showStart "commit" ""
Annex.Branch.commit "update"
ifM isDirect
@ -163,6 +166,12 @@ commit = next $ next $ do
return True
)
commitMsg :: Annex String
commitMsg = do
u <- getUUID
m <- uuidMap
return $ "git-annex in " ++ fromMaybe "unknown" (M.lookup u m)
commitStaged :: Git.Branch.CommitMode -> String -> Annex Bool
commitStaged commitmode commitmessage = go =<< inRepo Git.Branch.currentUnsafe
where