parseReq :: Options -> (Req, Differ)
parseReq opts
- | textDiff opts = (mk (restOptions opts), textDiffer)
+ | textDiff opts = case separate (== "--") (restOptions opts) of
+ (_,[]) -> (mk (restOptions opts), textDiffer [])
+ (ps,rest) -> (mk rest, textDiffer ps)
| otherwise = case separate (== "--") (restOptions opts) of
(c:ps, l) -> (mk l, externalDiffer c ps)
([],_) -> badopts
externalDiffer :: String -> [String] -> Differ
externalDiffer c ps = \req -> boolSystem c (map Param ps ++ serializeReq req )
-textDiffer :: Differ
-textDiffer req = do
+textDiffer :: [String] -> Differ
+textDiffer diffopts req = do
putStrLn ("diff a/" ++ rPath req ++ " b/" ++ rPath req)
-- diff exits nonzero on difference, so ignore exit status
- void $ boolSystem "diff"
+ void $ boolSystem "diff" $
[ Param "-u"
, Param (rOldFile req)
, Param (rNewFile req)
- ]
+ ] ++ map Param diffopts
return True
# SYNOPSIS
-git annex diffdriver --text
+git annex diffdriver --text [-- --opts --]
git annex diffdriver `-- cmd --opts --`
# OPTIONS
To diff text files with diff(1), use the "--text" option.
+To pass additional options to diff(1), use eg "--text -- --color --"
To use an external diff driver command, the options must start with
"--" followed by the diff driver command, its options, and another "--"