@@ -897,16 +897,15 @@ vcsTestDriverGit
897
897
gitconfigExists <- doesFileExist gitconfigPath
898
898
unless gitconfigExists $ do
899
899
writeFile gitconfigPath gitconfig
900
- git $ [" init" ] ++ verboseArg
900
+ gitQuiet [" init" ]
901
901
, vcsAddFile = \ _ filename ->
902
902
git [" add" , filename]
903
903
, vcsCommitChanges = \ _state -> do
904
- git $
904
+ gitQuiet
905
905
[ " commit"
906
906
, " --all"
907
907
, " --message=a patch"
908
908
]
909
- ++ verboseArg
910
909
commit <- git' [" rev-parse" , " HEAD" ]
911
910
let commit' = takeWhile (not . isSpace) commit
912
911
return (Just commit')
@@ -928,22 +927,22 @@ vcsTestDriverGit
928
927
(||)
929
928
<$> doesFileExist (repoRoot </> dest)
930
929
<*> doesDirectoryExist (repoRoot </> dest)
931
- when destExists $ git [" rm" , " -f " , dest]
930
+ when destExists $ gitQuiet [" rm" , " --force " , dest]
932
931
-- If there is an old submodule git dir with the same name, remove it.
933
932
-- It most likely has a different URL and `git submodule add` will fai.
934
933
submoduleGitDirExists <- doesDirectoryExist $ submoduleGitDir dest
935
934
when submoduleGitDirExists $ removeDirectoryRecursive (submoduleGitDir dest)
936
- git [" submodule" , " add" , source, dest]
937
- git [" submodule" , " update" , " --init" , " --recursive" , " --force" ]
935
+ gitQuiet [" submodule" , " add" , source, dest]
936
+ gitQuiet [" submodule" , " update" , " --init" , " --recursive" , " --force" ]
938
937
, vcsSwitchBranch = \ RepoState {allBranches} branchname -> do
939
938
deinitAndRemoveCachedSubmodules
940
939
unless (branchname `Map.member` allBranches) $
941
- git [" branch" , branchname]
942
- git $ [" checkout" , branchname] ++ verboseArg
940
+ gitQuiet [" branch" , branchname]
941
+ gitQuiet [" checkout" , branchname]
943
942
updateSubmodulesAndCleanup
944
943
, vcsCheckoutTag = Left $ \ tagname -> do
945
944
deinitAndRemoveCachedSubmodules
946
- git $ [" checkout" , " --detach" , " --force" , tagname] ++ verboseArg
945
+ gitQuiet [" checkout" , " --detach" , " --force" , tagname]
947
946
updateSubmodulesAndCleanup
948
947
}
949
948
where
@@ -981,24 +980,32 @@ vcsTestDriverGit
981
980
]
982
981
}
983
982
}
983
+
984
984
gitInvocation args =
985
985
(programInvocation (vcsProgram vcs') args)
986
986
{ progInvokeCwd = Just repoRoot
987
987
}
988
+
988
989
git = runProgramInvocation verbosity . gitInvocation
989
990
git' = getProgramInvocationOutput verbosity . gitInvocation
991
+
992
+ gitQuiet [] = git []
993
+ gitQuiet (cmd : args) = git (cmd : verboseArg ++ args)
994
+
990
995
verboseArg = [" --quiet" | verbosity < Verbosity. normal]
996
+
991
997
submoduleGitDir path = repoRoot </> " .git" </> " modules" </> path
992
998
deinitAndRemoveCachedSubmodules = do
993
- git $ [" submodule" , " deinit" , " --force" , " --all" ] ++ verboseArg
999
+ gitQuiet [" submodule" , " deinit" , " --force" , " --all" ]
994
1000
let gitModulesDir = repoRoot </> " .git" </> " modules"
995
1001
gitModulesExists <- doesDirectoryExist gitModulesDir
996
1002
when gitModulesExists $ removeDirectoryRecursive gitModulesDir
997
1003
updateSubmodulesAndCleanup = do
998
- git $ [" submodule" , " sync" , " --recursive" ] ++ verboseArg
999
- git $ [" submodule" , " update" , " --init" , " --recursive" , " --force" ] ++ verboseArg
1000
- git $ [" submodule" , " foreach" , " --recursive" ] ++ verboseArg ++ [" git clean -ffxdq" ]
1001
- git $ [" clean" , " -ffxdq" ] ++ verboseArg
1004
+ gitQuiet [" submodule" , " sync" , " --recursive" ]
1005
+ gitQuiet [" submodule" , " update" , " --init" , " --recursive" , " --force" ]
1006
+ -- Note: We need to manually add `verboseArg` here so that the embedded `git clean` command includes it as well.
1007
+ gitQuiet $ [" submodule" , " foreach" , " --recursive" , " git clean -ffxdq" ] ++ verboseArg
1008
+ gitQuiet [" clean" , " -ffxdq" ]
1002
1009
1003
1010
type MTimeChange = Int
1004
1011
0 commit comments