summaryrefslogtreecommitdiff
path: root/git-format-patch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-11 16:49:45 -0800
committerJunio C Hamano <junkio@cox.net>2005-12-11 16:49:45 -0800
commita9572072f0ab0ac97e64b0dc01254a3ad95befe1 (patch)
tree2375e3b4aea11444375f9f587c8ca4cd8d22d6d0 /git-format-patch.sh
parent423325a2d24638ddcc82ce47be5e40be550f4507 (diff)
parentb825e6ff5d003db8efd1ed43cdbbb9d637df0a0c (diff)
GIT 0.99.9m aka 1.0rc5v1.0rc5v0.99.9m
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-format-patch.sh')
-rwxr-xr-xgit-format-patch.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/git-format-patch.sh b/git-format-patch.sh
index 1eebe857c0..921feee59c 100755
--- a/git-format-patch.sh
+++ b/git-format-patch.sh
@@ -254,6 +254,15 @@ Date: '"$ad"
}
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
while read commit
do
@@ -262,10 +271,7 @@ do
case "$numbered" in
'') num= ;;
*)
- case $total in
- 1) num= ;;
- *) num=' '`printf "%d/%d" $i $total` ;;
- esac
+ num=`printf "$numfmt" $i` ;;
esac
file=`printf '%04d-%stxt' $i "$title"`