{"thread":{"id":"12827","subject":"git-merge adds test to a message -- bug?","startedAt":"2008-03-23T23:13:31Z","lastAt":"2008-04-09T10:40:48Z","messageCount":7,"participants":["Jörg Sommer","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72828","messageId":"slrnfudp0q.19k.joerg@alea.gnuu.de","threadId":"12827","inReplyTo":null,"subject":"git-merge adds test to a message -- bug?","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2008-03-23T23:13:31Z","receivedAt":"2008-03-23T23:13:31Z","isPatch":false,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"Hi,\n\nis it correct, that this test fails?\n\ndiff --git a/t/t6032-merge-message.sh b/t/t6032-merge-message.sh\nnew file mode 100755\nindex 0000000..97157bd\n--- /dev/null\n+++ b/t/t6032-merge-message.sh\n@@ -0,0 +1,30 @@\n+#!/bin/sh\n+\n+test_description='test for merge message'\n+\n+. ./test-lib.sh\n+\n+test_expect_success setup '\n+\t: > file1 &&\n+\tgit add file1 &&\n+        test_tick &&\n+\tgit commit -m \"commit 1\" &&\n+\t: > file2 &&\n+\tgit add file2 &&\n+        test_tick &&\n+\tgit commit -m \"commit 2\" &&\n+\n+\tgit checkout -b new-branch HEAD~1 &&\n+\t: > file3 &&\n+\tgit add file3 &&\n+        test_tick &&\n+\tgit commit -m \"commit 3\"\n+'\n+\n+test_expect_success merge 'git merge -m master-merge master'\n+\n+test_expect_failure 'merge message check' '\n+\ttest \"$(git cat-file commit HEAD | sed \"1,/^\\$/d\")\" = master-merge\n+'\n+\n+test_done\n\nBye, Jörg.\n-- \nUnsere Zweifel sind Verräter und oft genug verspielen wir den möglichen\nGewinn, weil wir den Versuch nicht wagen.\n"},{"id":"72856","messageId":"7vabko3dm2.fsf@gitster.siamese.dyndns.org","threadId":"12827","inReplyTo":"slrnfudp0q.19k.joerg@alea.gnuu.de","subject":"Re: git-merge adds test to a message -- bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-24T05:17:09Z","receivedAt":"2008-03-24T05:17:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jörg Sommer <joerg@alea.gnuu.de> writes:\n\n> is it correct, that this test fails?\n\nInteresting.\n\nThe following patch will change the bahaviour to what your test script\nexpects, but by looking at the original code, you can tell that it is\nindeed the intended behaviour of \"-M' to _allow_ you to _prepend_ your own\nmessage to the standardized \"Merge these\" message, not _replace_ with it.\n\nI unfortunately do not recall why _prepend_, and not _replace_, had to be\nthe right behaviour.  Unless somebody can point out there was a valid\nreason but that reason is not relevant anymore, I am reluctant to apply\nthe patch below this late in the cycle.\n\n git-merge.sh |   27 +++++++++++++++------------\n 1 files changed, 15 insertions(+), 12 deletions(-)\n\ndiff --git a/git-merge.sh b/git-merge.sh\nindex 7dbbb1d..a5ce649 100755\n--- a/git-merge.sh\n+++ b/git-merge.sh\n@@ -250,17 +250,19 @@ else\n \t# We are invoked directly as the first-class UI.\n \thead_arg=HEAD\n \n-\t# All the rest are the commits being merged; prepare\n-\t# the standard merge summary message to be appended to\n-\t# the given message.  If remote is invalid we will die\n-\t# later in the common codepath so we discard the error\n-\t# in this loop.\n-\tmerge_name=$(for remote\n-\t\tdo\n-\t\t\tmerge_name \"$remote\"\n-\t\tdone | git fmt-merge-msg\n-\t)\n-\tmerge_msg=\"${merge_msg:+$merge_msg$LF$LF}$merge_name\"\n+\tif test -z \"$merge_msg\"\n+\tthen\n+\t\t# All the rest are the commits being merged; prepare\n+\t\t# the standard merge summary message to be appended to\n+\t\t# the given message.  If remote is invalid we will die\n+\t\t# later in the common codepath so we discard the error\n+\t\t# in this loop.\n+\t\tmerge_msg=$(for remote\n+\t\t\tdo\n+\t\t\t\tmerge_name \"$remote\"\n+\t\t\tdone | git fmt-merge-msg\n+\t\t)\n+\tfi\n fi\n head=$(git rev-parse --verify \"$head_arg\"^0) || usage\n \n"},{"id":"72875","messageId":"alpine.LSU.1.00.0803241208400.4353@racer.site","threadId":"12827","inReplyTo":"7vabko3dm2.fsf@gitster.siamese.dyndns.org","subject":"Re: git-merge adds test to a message -- bug?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-03-24T11:08:59Z","receivedAt":"2008-03-24T11:08:59Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 23 Mar 2008, Junio C Hamano wrote:\n\n> I unfortunately do not recall why _prepend_, and not _replace_, had to be\n> the right behaviour.\n\nhttp://article.gmane.org/gmane.comp.version-control.git/31896/match=git+merge+make+usable\n\nHth,\nDscho\n"},{"id":"72911","messageId":"7viqzcvznm.fsf@gitster.siamese.dyndns.org","threadId":"12827","inReplyTo":"alpine.LSU.1.00.0803241208400.4353@racer.site","subject":"Re: git-merge adds test to a message -- bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-24T16:45:49Z","receivedAt":"2008-03-24T16:45:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Sun, 23 Mar 2008, Junio C Hamano wrote:\n>\n>> I unfortunately do not recall why _prepend_, and not _replace_, had to be\n>> the right behaviour.\n>\n> http://article.gmane.org/gmane.comp.version-control.git/31896/match=git+merge+make+usable\n>\n> Hth,\n\nOk, it helped.\n\nSo it was \"my suspicion that people who would want to pass -m would want\nit to behave this way\".\n\nI do not care deeply either way myself, as I never have found use for -m\nto the merge command, but I think it could have been argued either way.\n\"If you want to include the standard message, you can do so yourself by\nrunning the fmt-merge-msg yourself\" would have been a valid argument too,\neven though it would make it a lot more cumbersome if many people wanted\nthe standard message anyway.\n\nI do not see any objections to the suspicion back then in the thread,\nthere may have been discussions and user requests that made me suspect\nthat nearby as well, and ever since the feature was defined that way there\nwasn't any objection until Jörg brought this up.\n\nSo I'd say we should let the sleeping dog lie for now.\n"},{"id":"73025","messageId":"20080325001247.GB26905@alea.gnuu.de","threadId":"12827","inReplyTo":"7viqzcvznm.fsf@gitster.siamese.dyndns.org","subject":"Re: git-merge adds test to a message -- bug?","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2008-03-25T00:12:47Z","receivedAt":"2008-03-25T00:12:47Z","isPatch":false,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"Hallo Junio,\n\nJunio C Hamano schrieb am Mon 24. Mar, 09:45 (-0700):\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > On Sun, 23 Mar 2008, Junio C Hamano wrote:\n> >\n> >> I unfortunately do not recall why _prepend_, and not _replace_, had to be\n> >> the right behaviour.\n> >\n> > http://article.gmane.org/gmane.comp.version-control.git/31896/match=git+merge+make+usable\n> >\n> > Hth,\n> \n> Ok, it helped.\n> \n> So it was \"my suspicion that people who would want to pass -m would want\n> it to behave this way\".\n> \n> I do not care deeply either way myself, as I never have found use for -m\n> to the merge command, but I think it could have been argued either way.\n\nI would like to argue for the replace way. :) Take git rebase -p as an\nexample. If a merge is included in the rebase, it's redone with git merge\n-m. Because git rebase works with detached heads you get merge messages\nlike this:\n\ncommit 580c95c6bb4bb74bdbf6776ca816560690c16c5d\nMerge: 62b68ef... 9604163...\nAuthor: A U Thor <author@example.com>\nDate:   Thu Apr 7 15:26:13 2005 -0700\n\n    Merge branch 'to-be-preserved' into to-be-rebased\n    \n    Merge commit '96041635cd9e0bd999384c1c30d7df40002a0742' into HEAD\n\nThis is an example from the test t3404. Simply run git log -g and search\nfor merges.\n\nMaybe a new option -M for merge could help? -m with the old behaviour to\nprepend and -M to replace.\n\nBye, Jörg.\n-- \nIRC: Der [Prof. Andreas Pfitzmann, TU Dresden] hat gerade vorgeschlagen, sie\n  sollen doch statt Trojanern die elektromagnetische Abstrahlung nutzen. Das\n  sei nicht massenfähig, ginge ohne Eingriff ins System, sei zielgerichtet,\n  und, der Hammer, das funktioniere ja bei Wahlcomputern schon sehr gut.\n"},{"id":"73071","messageId":"alpine.LSU.1.00.0803252102140.10660@wbgn129.biozentrum.uni-wuerzburg.de","threadId":"12827","inReplyTo":"20080325001247.GB26905@alea.gnuu.de","subject":"Re: git-merge adds test to a message -- bug?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-03-25T20:04:33Z","receivedAt":"2008-03-25T20:04:33Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 25 Mar 2008, Jörg Sommer wrote:\n\n> Junio C Hamano schrieb am Mon 24. Mar, 09:45 (-0700):\n> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > > On Sun, 23 Mar 2008, Junio C Hamano wrote:\n> > >\n> > >> I unfortunately do not recall why _prepend_, and not _replace_, had \n> > >> to be the right behaviour.\n> > >\n> > > http://article.gmane.org/gmane.comp.version-control.git/31896/match=git+merge+make+usable\n> > >\n> > > Hth,\n> > \n> > Ok, it helped.\n> > \n> > So it was \"my suspicion that people who would want to pass -m would \n> > want it to behave this way\".\n> > \n> > I do not care deeply either way myself, as I never have found use for \n> > -m to the merge command, but I think it could have been argued either \n> > way.\n> \n> I would like to argue for the replace way. :) Take git rebase -p as an \n> example. If a merge is included in the rebase, it's redone with git \n> merge -m. Because git rebase works with detached heads you get merge \n> messages like this: [...]\n\nThat only means that the original author of rebase -p was a lazy bastard \nand did not use the proper way to call git-merge, namely\n\n\tgit <msg> HEAD <the-other-branch>\n\nNow, let's try git log -S to find out who that inexcusably lazy bum was.\n\nCiao,\nDscho"},{"id":"73949","messageId":"20080409104048.GA1782@alea.gnuu.de","threadId":"12827","inReplyTo":"alpine.LSU.1.00.0803252102140.10660@wbgn129.biozentrum.uni-wuerzburg.de","subject":"Re: git-merge adds test to a message -- bug?","fromName":"Jörg Sommer","fromEmail":"joerg@alea.gnuu.de","sentAt":"2008-04-09T10:40:48Z","receivedAt":"2008-04-09T10:40:48Z","isPatch":false,"sender":{"key":"joerg@alea.gnuu.de","avatar":null},"body":"Hallo Johannes,\n\nJohannes Schindelin schrieb am Tue 25. Mar, 21:04 (+0100):\n> On Tue, 25 Mar 2008, Jörg Sommer wrote:\n> > Junio C Hamano schrieb am Mon 24. Mar, 09:45 (-0700):\n> > > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > > > On Sun, 23 Mar 2008, Junio C Hamano wrote:\n> > > >\n> > > >> I unfortunately do not recall why _prepend_, and not _replace_, had \n> > > >> to be the right behaviour.\n> > > >\n> > > > http://article.gmane.org/gmane.comp.version-control.git/31896/match=git+merge+make+usable\n> > > \n> > > So it was \"my suspicion that people who would want to pass -m would \n> > > want it to behave this way\".\n> > > \n> > > I do not care deeply either way myself, as I never have found use for \n> > > -m to the merge command, but I think it could have been argued either \n> > > way.\n> > \n> > I would like to argue for the replace way. :) Take git rebase -p as an \n> > example. If a merge is included in the rebase, it's redone with git \n> > merge -m. Because git rebase works with detached heads you get merge \n> > messages like this: [...]\n> \n> That only means that the original author of rebase -p was a lazy bastard \n> and did not use the proper way to call git-merge, namely\n> \n> \tgit <msg> HEAD <the-other-branch>\n\nIt this really a proper way to call git merge? The manpage says:\n\n    The second syntax (<msg> HEAD <remote>) is supported for historical\n    reasons. Do not use it from the command line or in new scripts. It is\n    the same as git merge -m <msg> <remote>.\n\nAnd how would you pass the option for the strategy to this form? Git\nrebase calls git merge with -s.\n\nBye, Jörg.\n-- \nBut in the case of \"git revert\", it should be an ancestor (or the user\nis just insane, in which case it doesn't matter - insane people can do\ninsane things)\nLinus Torvalds <alpine.LFD.1.00.0801041031590.2811@woody.linux-foundation.org>\n"}]}