status: Pass --ignore-submodules=when option on to git status.
Didn't make --ignore-submodules without a value be handled because I can't see a way to make optparse-applicative parse that. I've opened a bug requesting a way to do that: https://github.com/pcapriotti/optparse-applicative/issues/243
This commit is contained in:
parent
a53daff32c
commit
75a15e1ad7
4 changed files with 39 additions and 14 deletions
|
@ -32,6 +32,7 @@ git-annex (6.20170215) UNRELEASED; urgency=medium
|
||||||
* When downloading in --json or --quiet mode, use curl in preference
|
* When downloading in --json or --quiet mode, use curl in preference
|
||||||
to wget, since curl is able to display only errors to stderr, unlike
|
to wget, since curl is able to display only errors to stderr, unlike
|
||||||
wget.
|
wget.
|
||||||
|
* status: Pass --ignore-submodules=when option on to git status.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 14 Feb 2017 15:54:25 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 14 Feb 2017 15:54:25 -0400
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,28 @@ cmd = notBareRepo $ noCommit $ noMessages $
|
||||||
withGlobalOptions [jsonOption] $
|
withGlobalOptions [jsonOption] $
|
||||||
command "status" SectionCommon
|
command "status" SectionCommon
|
||||||
"show the working tree status"
|
"show the working tree status"
|
||||||
paramPaths (withParams seek)
|
paramPaths (seek <$$> optParser)
|
||||||
|
|
||||||
seek :: CmdParams -> CommandSeek
|
data StatusOptions = StatusOptions
|
||||||
seek = withWords start
|
{ statusFiles :: CmdParams
|
||||||
|
, ignoreSubmodules :: Maybe String
|
||||||
|
}
|
||||||
|
|
||||||
|
optParser :: CmdParamsDesc -> Parser StatusOptions
|
||||||
|
optParser desc = StatusOptions
|
||||||
|
<$> cmdParams desc
|
||||||
|
<*> optional (strOption
|
||||||
|
( long "ignore-submodules"
|
||||||
|
<> help "passed on to git status"
|
||||||
|
<> metavar "WHEN"
|
||||||
|
))
|
||||||
|
|
||||||
|
seek :: StatusOptions -> CommandSeek
|
||||||
|
seek o = withWords (start o) (statusFiles o)
|
||||||
|
|
||||||
start :: [FilePath] -> CommandStart
|
start :: StatusOptions -> [FilePath] -> CommandStart
|
||||||
start locs = do
|
start o locs = do
|
||||||
(l, cleanup) <- inRepo $ getStatus locs
|
(l, cleanup) <- inRepo $ getStatus ps locs
|
||||||
getstatus <- ifM isDirect
|
getstatus <- ifM isDirect
|
||||||
( return statusDirect
|
( return statusDirect
|
||||||
, return $ \s -> pure (Just s)
|
, return $ \s -> pure (Just s)
|
||||||
|
@ -35,6 +49,10 @@ start locs = do
|
||||||
forM_ l $ \s -> maybe noop displayStatus =<< getstatus s
|
forM_ l $ \s -> maybe noop displayStatus =<< getstatus s
|
||||||
void $ liftIO cleanup
|
void $ liftIO cleanup
|
||||||
stop
|
stop
|
||||||
|
where
|
||||||
|
ps = case ignoreSubmodules o of
|
||||||
|
Nothing -> []
|
||||||
|
Just s -> [Param $ "--ignore-submodules="++s]
|
||||||
|
|
||||||
displayStatus :: Status -> Annex ()
|
displayStatus :: Status -> Annex ()
|
||||||
-- renames not shown in this simplified status
|
-- renames not shown in this simplified status
|
||||||
|
|
|
@ -64,13 +64,14 @@ parseStatusZ = go []
|
||||||
cparse '?' = Just Untracked
|
cparse '?' = Just Untracked
|
||||||
cparse _ = Nothing
|
cparse _ = Nothing
|
||||||
|
|
||||||
getStatus :: [FilePath] -> Repo -> IO ([Status], IO Bool)
|
getStatus :: [CommandParam] -> [FilePath] -> Repo -> IO ([Status], IO Bool)
|
||||||
getStatus l r = do
|
getStatus ps fs r = do
|
||||||
(ls, cleanup) <- pipeNullSplit params r
|
(ls, cleanup) <- pipeNullSplit ps' r
|
||||||
return (parseStatusZ ls, cleanup)
|
return (parseStatusZ ls, cleanup)
|
||||||
where
|
where
|
||||||
params =
|
ps' = concat
|
||||||
[ Param "status"
|
[ [Param "status"]
|
||||||
, Param "-uall"
|
, ps
|
||||||
, Param "-z"
|
, [ Param "-uall" , Param "-z"]
|
||||||
] ++ map File l
|
, map File fs
|
||||||
|
]
|
||||||
|
|
|
@ -23,6 +23,11 @@ Particularly useful in direct mode.
|
||||||
Enable JSON output. This is intended to be parsed by programs that use
|
Enable JSON output. This is intended to be parsed by programs that use
|
||||||
git-annex. Each line of output is a JSON object.
|
git-annex. Each line of output is a JSON object.
|
||||||
|
|
||||||
|
* `--ignore-submodules=when`
|
||||||
|
|
||||||
|
This option is passed on to git status, see its man page for
|
||||||
|
details.
|
||||||
|
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
[[git-annex]](1)
|
[[git-annex]](1)
|
||||||
|
|
Loading…
Reference in a new issue