avoid spurious blank line when updating adjusted branch

git checkout run with --quiet should have no output
This commit is contained in:
Joey Hess 2020-11-16 14:31:02 -04:00
parent 0896038ba7
commit 557a6e11a6
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 16 additions and 16 deletions

View file

@ -223,19 +223,19 @@ enterAdjustedBranch adj = inRepo Git.Branch.current >>= \case
, do , do
b <- preventCommits $ const $ b <- preventCommits $ const $
adjustBranch adj origbranch adjustBranch adj origbranch
checkoutAdjustedBranch b [] checkoutAdjustedBranch b False
) )
checkoutAdjustedBranch :: AdjBranch -> [CommandParam] -> Annex Bool checkoutAdjustedBranch :: AdjBranch -> Bool -> Annex Bool
checkoutAdjustedBranch (AdjBranch b) checkoutparams = do checkoutAdjustedBranch (AdjBranch b) quietcheckout = do
showOutput -- checkout can have output in large repos -- checkout can have output in large repos
unless quietcheckout
showOutput
inRepo $ Git.Command.runBool $ inRepo $ Git.Command.runBool $
[ Param "checkout" [ Param "checkout"
, Param $ fromRef $ Git.Ref.base b , Param $ fromRef $ Git.Ref.base b
-- always show checkout progress, even if --quiet is used , if quietcheckout then Param "--quiet" else Param "--progress"
-- to suppress other messages ]
, Param "--progress"
] ++ checkoutparams
{- Already in a branch with this adjustment, but the user asked to enter it {- Already in a branch with this adjustment, but the user asked to enter it
- again. This should have the same result as propagating any commits - again. This should have the same result as propagating any commits
@ -265,7 +265,7 @@ updateAdjustedBranch adj (AdjBranch currbranch) origbranch
-- Make git checkout quiet to avoid warnings about -- Make git checkout quiet to avoid warnings about
-- disconnected branch tips being lost. -- disconnected branch tips being lost.
checkoutAdjustedBranch b [Param "--quiet"] checkoutAdjustedBranch b True
| otherwise = preventCommits $ \commitlck -> do | otherwise = preventCommits $ \commitlck -> do
-- Done for consistency. -- Done for consistency.
_ <- propigateAdjustedCommits' origbranch adj commitlck _ <- propigateAdjustedCommits' origbranch adj commitlck
@ -302,7 +302,6 @@ adjustedBranchRefresh _af a = do
checkcounter n checkcounter n
-- Special case, 1 (or true) refreshes only at shutdown. -- Special case, 1 (or true) refreshes only at shutdown.
| n == 1 = pure False | n == 1 = pure False
| n == 2 = pure True
| otherwise = Annex.withState $ \s -> | otherwise = Annex.withState $ \s ->
let !c = Annex.adjustedbranchrefreshcounter s + 1 let !c = Annex.adjustedbranchrefreshcounter s + 1
!enough = c >= pred n !enough = c >= pred n
@ -337,7 +336,7 @@ adjustToCrippledFileSystem = do
_ -> do _ -> do
let adjbranch = originalToAdjusted currbranch adj let adjbranch = originalToAdjusted currbranch adj
ifM (inRepo (Git.Ref.exists $ adjBranch adjbranch)) ifM (inRepo (Git.Ref.exists $ adjBranch adjbranch))
( unlessM (checkoutAdjustedBranch adjbranch []) $ ( unlessM (checkoutAdjustedBranch adjbranch False) $
failedenter failedenter
, unlessM (enterAdjustedBranch adj) $ , unlessM (enterAdjustedBranch adj) $
failedenter failedenter

View file

@ -1023,11 +1023,12 @@ Like other git commands, git-annex is configured via `.git/config`.
controls how frequently the branch is refreshed. controls how frequently the branch is refreshed.
Refreshing the branch takes some time, so doing it after every file Refreshing the branch takes some time, so doing it after every file
can be too slow. The default value is 0 (or false), which does not can be too slow. (It also can generate a lot of dangling git objects.)
refresh the branch. 1 (or true) will refresh once, after git-annex The default value is 0 (or false), which does not
has made other changes. Higher values refresh after approximately that refresh the branch. Setting 1 (or true) will refresh only once,
many files need to be updated. Ie, 2 refreshes after every file, after git-annex has made other changes. Setting 2 refreshes after every
and 100 after every 99 files. file, 3 after every other file, and so on; setting 100 refreshes after
every 99 files.
(If git-annex gets faster in the future, refresh rates will increase (If git-annex gets faster in the future, refresh rates will increase
proportional to the speed improvements.) proportional to the speed improvements.)