summaryrefslogtreecommitdiff
path: root/Command/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-02-11 13:33:55 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-02-11 13:34:05 -0400
commit0dfcca521027baef75953b644aaf71dc58bec80b (patch)
treec358277a63208281bd2df177de62b28af81da5af /Command/Sync.hs
parentff9fa516cdcf529e079e48b183c213a393c1a128 (diff)
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.
Diffstat (limited to 'Command/Sync.hs')
-rw-r--r--Command/Sync.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index 65a025606..ddd4e0309 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -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