{"thread":{"id":"31791","subject":"Re: [BUG] \"git commit\" after \"cherry-pick -n\" conflict clobbers .git/COMMIT_EDITMSG","startedAt":"2012-10-11T20:50:35Z","lastAt":"2012-10-11T20:50:35Z","messageCount":1,"participants":["dirson@bertin.fr"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"201022","messageId":"20121011205035.GB9783@home.lan","threadId":"31791","inReplyTo":null,"subject":"Re: [BUG] \"git commit\" after \"cherry-pick -n\" conflict clobbers .git/COMMIT_EDITMSG","fromName":"","fromEmail":"dirson@bertin.fr","sentAt":"2012-10-11T20:50:35Z","receivedAt":"2012-10-11T20:50:35Z","isPatch":false,"sender":{"key":"dirson@bertin.fr","avatar":null},"body":"> > ~/softs/linux$ echo foo > .git/COMMIT_EDITMSG\n>\n> Why are you mucking with such an internal implementation detail in\n> the first place?\n\nI only tried to make it terse for the bugreport, I hit this while I\nwas resolving conflicts during a merge.  I aknowledge that using\n\"cherry-pick -n\" to bring some contents to resolve a conflict is not\nreally nominal - my use case involves re-merging an updated \"upstream\"\nbranch, and bringing in fixups to the original merge.\n\n> > ~/softs/linux$ git cherry-pick -n b55f3d92cd\n> > error: could not apply b55f3d9... Linux 2.6.32.26\n> > hint: after resolving the conflicts, mark the corrected paths\n> > hint: with 'git add ' or 'git rm '\n> > ~/softs/linux$ cat .git/COMMIT_EDITMSG\n> > foo\n> >\n> > So far, so good. But then \"git commit\" brings me the message\n> from the\n> > cherry-picked commit plus the list of conflicted files, and I\n> can verify that\n> > it is now the contents of .git/COMMIT_EDITMSG.\n>\n> You verified that \"what\" is now in .git/COMMIT_EDITMSG? The commit\n> log message for you to edit to record the result of the cherry-pick?\n\nPrecisely\n\n> If that is the case, what is the problem?\n\nI used \"-n\" precisely because I did not want to make a standalone\ncommit, and the message from the cherry-picked source has no value to\nme.  If it had, I would instead have used cherry-pick without -n, and\namended the commit afterwards.\n\nIn the general case, I only ever use -n when I'm squashing changes\nand similar tasks.  Are there use cases out there, where it makes\nsense to keep that source message, when we don't want the commit to be\ncreated right away ?\n\n\n> If anything you had in .git/COMMIT_EDITMSG before you started\n> \"'cherry-pick -n', edit further to adjust, and then 'commit'\"\n> sequence were to appear in the editor to edit the commit log,\n> it would be a bug, I would think.\n\nWell, seems to depend on use case - I find it a bug when the merge message,\nnotably containing the list of conflicting files, gets clobbered.\n\nAlso, I have not checked how git gui reacts, but I would assume that\nwhen carefully and iteratively composing a commit message from there,\nwhich is IIRC managed using .git/COMMIT_EDITMSG, it would not be\ndesired to get this content clobbered the same way.\n\nTo me it looks like the problem is that the commit message in\npreparation is not considered precious information, when there are at\nleast some cases where it indeed should be.  I'm not sure however how\nthat should be done:\n\n* suddenly claiming it is precious (and require some form of -f to\n  clobber it) when it was mostly not is likely to break a number of\n  use cases\n* looking at the context (are we resolving a merge or similar ?) to\n  consider it precious is likely to miss some cases\n* declaring a new official location (or API/command ?) to store\n  considered-precious message being composed may bring its own lot of\n  semantic difficulties\n"}]}