Cosmetic git-am interactive bug

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

Cosmetic git-am interactive bug

From: Jeff Garzik <hidden>
Date: 2016-06-15 22:43:56

Just now, I was exploring git-am's interactive mode, so as to comply 
with Linus's urgings of a cleaner changelog <grin>.  I had a raw email 
changelog with the subject

	Re: 2.6.24-rc3-git6: Reported regressions from 2.6.23

I used the [e]dit feature of interactive mode to change this 
first-line/one-line summary to

	pata_amd/pata_via: de-couple programming of PIO/MWDMA and UDMA
	timings

When I hit [y]es to apply the patch, git reported

	Applying 2.6.24-rc3-git6: Reported regressions from 2.6.23

	Wrote tree 34cebd48e3b4e90fe3e6a6c6c03154ae1ed0c827
	Committed: 943547abdfe9b4e27e36a25987909619908dffbf

The use of the older one-line summary led me to believe that it had not 
committed my changelog edits.  Looking at the result, however, proved 
that the commit changelog was my new, corrected version.

Thus, I concluded that the printing of the old-and-no-longer-valid 
changelog during the commit-to-tree phase was a bug.

Please see attached file for full example.

Thanks,

	Jeff

Re: Cosmetic git-am interactive bug

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:56

Jeff Garzik [off-list ref] writes:
The use of the older one-line summary led me to believe that it had
not committed my changelog edits.  Looking at the result, however,
proved that the commit changelog was my new, corrected version.
I knew about this for quite some time but it was a very low priority for
me.  This should fix it.

Signed-off-by: Junio C Hamano <redacted>
---
diff --git a/git-am.sh b/git-am.sh
index 2e40708..339d863 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -117,6 +117,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=
@@ -376,6 +380,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" ;;

Re: Cosmetic git-am interactive bug

From: Jeff Garzik <hidden>
Date: 2016-06-15 22:43:56

Junio C Hamano wrote:
Jeff Garzik [off-list ref] writes:
quoted
The use of the older one-line summary led me to believe that it had
not committed my changelog edits.  Looking at the result, however,
proved that the commit changelog was my new, corrected version.
I knew about this for quite some time but it was a very low priority for
me.  This should fix it.

Signed-off-by: Junio C Hamano <redacted>
Thanks!  :)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help