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

@ -20,7 +20,6 @@ import qualified Annex
import qualified Git
import qualified Git.Config
import qualified Git.Command
import qualified Command.Sync
import Config.Files
import Utility.FreeDesktop
import Utility.DiskFree
@ -30,6 +29,7 @@ import Utility.Mounts
import Utility.DataUnits
import Remote (prettyUUID)
import Annex.UUID
import Annex.CurrentBranch
import Types.StandardGroups
import Logs.PreferredContent
import Logs.UUID
@ -212,7 +212,7 @@ postNewRepositoryR = page "Add another repository" (Just Configuration) $ do
- immediately pulling from it. Also spawns a sync to push to it as well. -}
immediateSyncRemote :: Remote -> Assistant ()
immediateSyncRemote r = do
currentbranch <- liftAnnex $ join Command.Sync.getCurrBranch
currentbranch <- liftAnnex $ getCurrentBranch
void $ manualPull currentbranch [r]
syncRemote r