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:
parent
c94e62cab5
commit
8be5a7269a
15 changed files with 228 additions and 169 deletions
|
@ -25,6 +25,7 @@ import qualified Annex.Branch
|
|||
import Annex.UUID
|
||||
import Annex.TaggedPush
|
||||
import Annex.Ssh
|
||||
import Annex.CurrentBranch
|
||||
import qualified Config
|
||||
import Git.Config
|
||||
import Config.DynamicConfig
|
||||
|
@ -79,8 +80,7 @@ reconnectRemotes rs = void $ do
|
|||
{- No local branch exists yet, but we can try pulling. -}
|
||||
sync (Nothing, _) = manualPull (Nothing, Nothing) =<< gitremotes
|
||||
go = do
|
||||
(failed, diverged) <- sync
|
||||
=<< liftAnnex (join Command.Sync.getCurrBranch)
|
||||
(failed, diverged) <- sync =<< liftAnnex getCurrentBranch
|
||||
addScanRemotes diverged =<<
|
||||
filterM (not <$$> liftIO . getDynamicConfig . remoteAnnexIgnore . Remote.gitconfig) rs
|
||||
return failed
|
||||
|
@ -127,7 +127,7 @@ pushToRemotes' now remotes = do
|
|||
Annex.Branch.commit =<< Annex.Branch.commitMessage
|
||||
(,,)
|
||||
<$> gitRepo
|
||||
<*> join Command.Sync.getCurrBranch
|
||||
<*> getCurrentBranch
|
||||
<*> getUUID
|
||||
ret <- go True branch g u remotes
|
||||
return ret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue