Code

Merge branch 'jc/maint-rebase-am' into maint
authorJunio C Hamano <gitster@pobox.com>
Sun, 20 Apr 2008 06:01:51 +0000 (23:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 20 Apr 2008 06:01:51 +0000 (23:01 -0700)
* jc/maint-rebase-am:
  rebase: do not munge commit log message

Conflicts:

git-am.sh

1  2 
git-am.sh

diff --cc git-am.sh
index a391254a709410cbf456296168f029c82bad303a,5a7695efae14fa3a0551bbed86a6184716dd7045..75886a8f2fb0c2244ba921398ae2339dc9ffea26
+++ b/git-am.sh
                        echo "Patch is empty.  Was it split wrong?"
                        stop_here $this
                }
-               SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"
-               case "$keep_subject" in -k)  SUBJECT="[PATCH] $SUBJECT" ;; esac
-               (printf '%s\n\n' "$SUBJECT"; cat "$dotest/msg") |
-                       git stripspace > "$dotest/msg-clean"
+               if test -f "$dotest/rebasing" &&
+                       commit=$(sed -e 's/^From \([0-9a-f]*\) .*/\1/' \
+                               -e q "$dotest/$msgnum") &&
+                       test "$(git cat-file -t "$commit")" = commit
+               then
+                       git cat-file commit "$commit" |
+                       sed -e '1,/^$/d' >"$dotest/msg-clean"
+               else
+                       SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"
+                       case "$keep_subject" in -k)  SUBJECT="[PATCH] $SUBJECT" ;; esac
 -                      (echo "$SUBJECT" ; echo ; cat "$dotest/msg") |
++                      (printf '%s\n\n' "$SUBJECT"; cat "$dotest/msg") |
+                               git stripspace > "$dotest/msg-clean"
+               fi
                ;;
        esac