mirror of https://github.com/mkerrisk/man-pages
scripts/bash_aliases: man_gitstaged(): Script around a porcelain git command
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>
This commit is contained in:
parent
f493a71fe1
commit
b08daf3c0c
|
@ -153,13 +153,11 @@ function pdfman()
|
|||
|
||||
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/, $//"
|
||||
}
|
||||
|
||||
########################################################################
|
||||
|
|
Loading…
Reference in New Issue