summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2010-01-14 05:54:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-14 08:27:56 (GMT)
commitf99e269c44a7f07699a92c7e31d31ed93dafb409 (patch)
tree77083a03328716f07c5b94444a598ed14bbac62d /git-rebase--interactive.sh
parent5065ed296abc1c0b66ad7c5e963e048cb90b6ee6 (diff)
downloadgit-f99e269c44a7f07699a92c7e31d31ed93dafb409.zip
git-f99e269c44a7f07699a92c7e31d31ed93dafb409.tar.gz
git-f99e269c44a7f07699a92c7e31d31ed93dafb409.tar.bz2
rebase -i: Simplify commit counting for generated commit messages
Read the old count from the first line of the old commit message rather than counting the number of commit message blocks in the file. This is simpler, faster, and more robust (e.g., it cannot be confused by strange commit message contents). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh11
1 files changed, 3 insertions, 8 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 702c979..d60e059 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -349,11 +349,9 @@ nth_string () {
make_squash_message () {
if test -f "$SQUASH_MSG"; then
- # We want to be careful about matching only the commit
- # message comment lines generated by this function.
- # "[snrt][tdh]" matches the nth_string endings.
- COUNT=$(($(sed -n "s/^# Th[^0-9]*\([1-9][0-9]*\)[snrt][tdh] commit message.*:/\1/p" \
- < "$SQUASH_MSG" | sed -ne '$p')+1))
+ COUNT=$(($(sed -n \
+ -e "1s/^# This is a combination of \(.*\) commits\./\1/p" \
+ -e "q" < "$SQUASH_MSG")+1))
echo "# This is a combination of $COUNT commits."
sed -e 1d -e '2,/^./{
/^$/d
@@ -376,9 +374,6 @@ make_squash_message () {
echo
echo "# The $(nth_string $COUNT) commit message will be skipped:"
echo
- # Comment the lines of the commit message out using
- # "# " rather than "# " to make them less likely to
- # confuse the sed regexp above.
git cat-file commit $2 | sed -e '1,/^$/d' -e 's/^/# /'
;;
esac