1
0
mirror of https://github.com/git/git.git synced 2024-11-18 05:53:54 +01:00

format-patch: use same number of digits in numbers

This would help sorting by subject in MUA work saner even though
MUA is too dumb to attempt sorting numbered subjects sanely.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2005-12-10 22:22:35 -08:00
parent eea420693b
commit 7564577a6c

@ -254,6 +254,15 @@ Date: '"$ad"
} }
total=`wc -l <$series | tr -dc "[0-9]"` total=`wc -l <$series | tr -dc "[0-9]"`
case "$total,$numbered" in
1,*)
numfmt='' ;;
*,t)
numfmt=`echo "$total" | wc -c`
numfmt=$(($numfmt-1))
numfmt=" %0${numfmt}d/$total"
esac
i=1 i=1
while read commit while read commit
do do
@ -262,10 +271,7 @@ do
case "$numbered" in case "$numbered" in
'') num= ;; '') num= ;;
*) *)
case $total in num=`printf "$numfmt" $i` ;;
1) num= ;;
*) num=' '`printf "%d/%d" $i $total` ;;
esac
esac esac
file=`printf '%04d-%stxt' $i "$title"` file=`printf '%04d-%stxt' $i "$title"`