git-am -i: report rewritten title
authorJunio C Hamano <gitster@pobox.com>
Wed, 5 Dec 2007 07:01:30 +0000 (23:01 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Dec 2007 00:27:17 +0000 (16:27 -0800)
Jeff Garzik noticed that "git am -i" reports the applied patch with
the title before the user edited it.  This was confusing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-am.sh

index 5792631..44c558c 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -102,6 +102,10 @@ It does not apply to blobs recorded in its index."
     unset GITHEAD_$his_tree
 }
 
+reread_subject () {
+       git stripspace <"$1" | sed -e 1q
+}
+
 prec=4
 dotest=.dotest sign= utf8=t keep= skip= interactive= resolved= binary=
 resolvemsg= resume=
@@ -372,6 +376,7 @@ do
                [aA]*) action=yes interactive= ;;
                [nN]*) action=skip ;;
                [eE]*) git_editor "$dotest/final-commit"
+                      SUBJECT=$(reread_subject "$dotest/final-commit")
                       action=again ;;
                [vV]*) action=again
                       LESS=-S ${PAGER:-less} "$dotest/patch" ;;