summaryrefslogtreecommitdiff
path: root/set-serial.sh
diff options
context:
space:
mode:
Diffstat (limited to 'set-serial.sh')
-rwxr-xr-xset-serial.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/set-serial.sh b/set-serial.sh
index e6aa016..93a9140 100755
--- a/set-serial.sh
+++ b/set-serial.sh
@@ -2,7 +2,7 @@
set -eu
-set-serial-number()
+set_serial_number()
{
sed >"$1.tmp" -e '/^$/q' "$1"
echo >>"$1.tmp" "#serial $2"
@@ -15,11 +15,11 @@ for n in "$@"; do
echo "$n ... "
# Determine the number of revisions that have occurred to the macro.
revision=$(git log --oneline -- "$n" | wc -l)
- # Update the serial number in the m4 file.
- set-serial-number "$n" "$revision"
# Check whether git regards the file as "modified" now. If it does,
# the serial number needs to be bumped one more time.
- if ! git diff --quiet --exit-code -- "$n"; then
- set-serial-number "$n" "$((revision + 1))"
+ if ! git diff --quiet --exit-code HEAD -- "$n"; then
+ revision="$((revision + 1))"
fi
+ # Update the serial number in the m4 file.
+ set_serial_number "$n" "$revision"
done