refactor getCurrentBranch

Both Command.Sync and Annex.Ingest had their own versions of this.

The one in Annex.Ingest used Git.Branch.currentUnsafe, but does not seem
to need it. That is only checking to see if it's in an adjusted unlocked
branch, and when in an adjusted branch, the branch does in fact exist,
so the added check that Git.Branch.current does is fine.

This commit was sponsored by Denis Dzyubenko on Patreon.
This commit is contained in:
Joey Hess 2018-10-19 15:17:48 -04:00
parent c94e62cab5
commit 8be5a7269a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
15 changed files with 228 additions and 169 deletions

View file

@ -32,6 +32,7 @@ import Annex.Link
import Annex.CatFile
import Annex.InodeSentinal
import Annex.Version
import Annex.CurrentBranch
import qualified Annex
import Utility.InodeCache
import Annex.Content.Direct
@ -228,7 +229,7 @@ commitStaged msg = do
Right _ -> do
ok <- Command.Sync.commitStaged Git.Branch.AutomaticCommit msg
when ok $
Command.Sync.updateSyncBranch =<< join Command.Sync.getCurrBranch
Command.Sync.updateSyncBranch =<< getCurrentBranch
return ok
{- OSX needs a short delay after a file is added before locking it down,