aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
authorAlejandro Colomar <alx@kernel.org>2024-11-04 02:01:08 +0100
committerAlejandro Colomar <alx@kernel.org>2024-11-04 02:03:30 +0100
commitb03e9c5e17f4c21cf74176e9b6d4278ab67dcbf2 (patch)
tree231959ffd416ff835db6457c6a124b86e0ec8c74 /scripts
parent1f01973ed55da3f4b5d2fc4097b94eab7cff7b20 (diff)
downloadman-pages-b03e9c5e17f4c21cf74176e9b6d4278ab67dcbf2.tar.gz
scripts/bash_aliases: man_gitstaged(): Trim the dirname(1) only for files within man/
I changed the behavior at some point to trim the dirname(1) for every file. However, that was mainly due to the inconvenience of not having a man/ directory. Also, I haven't been consistent with that behavior, and have been manually adding back the dirname(1), so let's bring back the old behavior --which is BTW still what the comment says it does--. Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bash_aliases8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/bash_aliases b/scripts/bash_aliases
index 318e66c56c..967a69efea 100644
--- a/scripts/bash_aliases
+++ b/scripts/bash_aliases
@@ -88,15 +88,15 @@ man_lsvar()
|uniq;
}
-# man_gitstaged prints a list of all files with changes staged for commit
-# (basename only if the files are within <man?/>), separated by ", ".
+# Print a list of all files with changes staged for commit
+# (basename only if the files are within <man/>), separated by ", ".
# Usage example: .../man-pages$ git commit -m "$(man_gitstaged): msg";
man_gitstaged()
{
git diff --staged --name-only \
|sed 's/$/, /' \
- |sed 's%.*/%%' \
+ |sed '/^man\//s%.*/%%' \
|tr -d '\n' \
- |sed 's/, $//'
+ |sed 's/, $//';
}