The output of 'git status' is not stable.
The more stable 'git status --porcelain' is more complex,
and scripting around it would be more complex.
However, 'git diff --staged --name-only' produces
the output that we were lookiong for.
Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
function man_gitstaged()
{
- git status \
- |sed "/Changes not staged for commit:/q" \
- |grep -E "^\s*(modified|deleted|new file):" \
- |sed "s/^.*:\s*/, /" \
+ git diff --staged --name-only \
+ |sed "s/$/, /" \
|sed "s%man[1-9]/%%" \
|tr -d '\n' \
- |sed "s/^, //"
+ |sed "s/, $//"
}
########################################################################