summaryrefslogtreecommitdiff
path: root/Git/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-05 15:54:52 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-05 15:54:52 -0400
commit9aa10480680cfe57e9d53bf488ba1b7d8e199a2a (patch)
treeb4c285c579cf746585477952a0e2e1e326a4f2e8 /Git/Remote
parentc1e01a5ccce06745d1344b3013b91331058f4b52 (diff)
Check git version at runtime, rather than assuming it will be the same as the git version used at build time when running git-checkattr and git-branch remove.
It's ok to probe every time for git-branch remove because that's run quite rarely. For git-checkattr, it's run only once, when starting the --batch mode, and so again the overhead is pretty minimal. This leaves 2 places where the build version is still used. git merge might be interactive or fail if one skews, and --no-gpg-sign might not be pased, or might be passed to a git that doesn't understand it if the other skews. It seems a little expensive to check the git version each time these are used. This doesn't seem likely to cause many problems, at least compared with check-attr hanging on skew.
Diffstat (limited to 'Git/Remote')
-rw-r--r--Git/Remote/Remove.hs22
1 files changed, 12 insertions, 10 deletions
diff --git a/Git/Remote/Remove.hs b/Git/Remote/Remove.hs
index 949019b22..ab1da9cde 100644
--- a/Git/Remote/Remove.hs
+++ b/Git/Remote/Remove.hs
@@ -13,15 +13,17 @@ import Common
import Git
import Git.Types
import qualified Git.Command
-import qualified Git.BuildVersion
+import qualified Git.Version
remove :: RemoteName -> Repo -> IO ()
-remove remotename = Git.Command.run
- [ Param "remote"
- -- name of this subcommand changed
- , Param $
- if Git.BuildVersion.older "1.8.0"
- then "rm"
- else "remove"
- , Param remotename
- ]
+remove remotename r = do
+ old <- Git.Version.older "1.8.0"
+ Git.Command.run
+ [ Param "remote"
+ -- name of this subcommand changed
+ , Param $
+ if old
+ then "rm"
+ else "remove"
+ , Param remotename
+ ] r