aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
authorAlejandro Colomar <alx.manpages@gmail.com>2021-05-09 23:38:57 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2021-05-10 11:27:19 +1200
commitb08daf3c0cb75fbbe7998f043b6d2bddd18cb3cf (patch)
tree44aea38472dc01b4b09229ed694ecc6dd0a254ec /scripts
parentf493a71fe135f6283b02a1f7376bbded46447bbe (diff)
downloadman-pages-b08daf3c0cb75fbbe7998f043b6d2bddd18cb3cf.tar.gz
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bash_aliases8
1 files changed, 3 insertions, 5 deletions
diff --git a/scripts/bash_aliases b/scripts/bash_aliases
index 8cedc4efc9..d9b6047d16 100644
--- a/scripts/bash_aliases
+++ b/scripts/bash_aliases
@@ -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/, $//"
}
########################################################################