aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-06-22 01:44:54 -0700
committerJunio C Hamano <junkio@cox.net>2006-06-22 01:46:48 -0700
commit5887ac821f9df614cfcf3349960523e1c36f2de7 (patch)
treef15a30476b1216885928dcb1c4cc36d155ac5a85
parent693c15dc282c36042eac8d215beae3067db7565c (diff)
downloadgit-5887ac821f9df614cfcf3349960523e1c36f2de7.tar.gz
git-5887ac821f9df614cfcf3349960523e1c36f2de7.tar.xz
rebase --merge: fix for rebasing more than 7 commits.
Instead of using 4-digit numbers to name commits being rebased, just use "cmt.$msgnum" string, with $msgnum as a decimal number without leading zero padding. This makes it possible to rebase more than 9999 commits, but of more practical importance is that the earlier code used "printf" to format already formatted $msgnum and barfed when it counted up to 0008. In other words, the old code was incapable of rebasing more than 7 commits, and this fixes that problem. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xgit-rebase.sh23
1 files changed, 10 insertions, 13 deletions
diff --git a/git-rebase.sh b/git-rebase.sh
index b9ce1125d..91594775e 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -67,16 +67,16 @@ continue_merge () {
prev_head=`git-rev-parse HEAD^0`
# save the resulting commit so we can read-tree on it later
- echo "$prev_head" > "$dotest/`printf %0${prec}d $msgnum`.result"
+ echo "$prev_head" > "$dotest/cmt.$msgnum.result"
echo "$prev_head" > "$dotest/prev_head"
# onto the next patch:
msgnum=$(($msgnum + 1))
- printf "%0${prec}d" "$msgnum" > "$dotest/msgnum"
+ echo "$msgnum" >"$dotest/msgnum"
}
call_merge () {
- cmt="$(cat $dotest/`printf %0${prec}d $1`)"
+ cmt="$(cat $dotest/cmt.$1)"
echo "$cmt" > "$dotest/current"
git-merge-$strategy "$cmt^" -- HEAD "$cmt"
rv=$?
@@ -108,15 +108,12 @@ finish_rb_merge () {
end="`cat $dotest/end`"
while test "$msgnum" -le "$end"
do
- msgnum=`printf "%0${prec}d" "$msgnum"`
- printf "%0${prec}d" "$msgnum" > "$dotest/msgnum"
-
- git-read-tree `cat "$dotest/$msgnum.result"`
+ git-read-tree `cat "$dotest/cmt.$msgnum.result"`
git-checkout-index -q -f -u -a
- git-commit -C "`cat $dotest/$msgnum`"
+ git-commit -C "`cat $dotest/cmt.$msgnum`"
- echo "Committed $msgnum"
- echo ' '`git-rev-list --pretty=oneline -1 HEAD | \
+ printf "Committed %0${prec}d" $msgnum
+ echo ' '`git-rev-list --pretty=oneline -1 HEAD | \
sed 's/^[a-f0-9]\+ //'`
msgnum=$(($msgnum + 1))
done
@@ -322,11 +319,11 @@ for cmt in `git-rev-list --no-merges "$upstream"..ORIG_HEAD \
| perl -e 'print reverse <>'`
do
msgnum=$(($msgnum + 1))
- echo "$cmt" > "$dotest/`printf "%0${prec}d" $msgnum`"
+ echo "$cmt" > "$dotest/cmt.$msgnum"
done
-printf "%0${prec}d" 1 > "$dotest/msgnum"
-printf "%0${prec}d" "$msgnum" > "$dotest/end"
+echo 1 >"$dotest/msgnum"
+echo $msgnum >"$dotest/end"
end=$msgnum
msgnum=1