git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: dirson@bertin.fr
To: Junio C Hamano <gitster@pobox.com>
Cc: git list <git@vger.kernel.org>
Subject: Re: [BUG] "git commit" after "cherry-pick -n" conflict clobbers .git/COMMIT_EDITMSG
Date: Thu, 11 Oct 2012 22:50:35 +0200	[thread overview]
Message-ID: <20121011205035.GB9783@home.lan> (raw)

> > ~/softs/linux$ echo foo > .git/COMMIT_EDITMSG
>
> Why are you mucking with such an internal implementation detail in
> the first place?

I only tried to make it terse for the bugreport, I hit this while I
was resolving conflicts during a merge.  I aknowledge that using
"cherry-pick -n" to bring some contents to resolve a conflict is not
really nominal - my use case involves re-merging an updated "upstream"
branch, and bringing in fixups to the original merge.

> > ~/softs/linux$ git cherry-pick -n b55f3d92cd
> > error: could not apply b55f3d9... Linux 2.6.32.26
> > hint: after resolving the conflicts, mark the corrected paths
> > hint: with 'git add ' or 'git rm '
> > ~/softs/linux$ cat .git/COMMIT_EDITMSG
> > foo
> >
> > So far, so good. But then "git commit" brings me the message
> from the
> > cherry-picked commit plus the list of conflicted files, and I
> can verify that
> > it is now the contents of .git/COMMIT_EDITMSG.
>
> You verified that "what" is now in .git/COMMIT_EDITMSG? The commit
> log message for you to edit to record the result of the cherry-pick?

Precisely

> If that is the case, what is the problem?

I used "-n" precisely because I did not want to make a standalone
commit, and the message from the cherry-picked source has no value to
me.  If it had, I would instead have used cherry-pick without -n, and
amended the commit afterwards.

In the general case, I only ever use -n when I'm squashing changes
and similar tasks.  Are there use cases out there, where it makes
sense to keep that source message, when we don't want the commit to be
created right away ?


> If anything you had in .git/COMMIT_EDITMSG before you started
> "'cherry-pick -n', edit further to adjust, and then 'commit'"
> sequence were to appear in the editor to edit the commit log,
> it would be a bug, I would think.

Well, seems to depend on use case - I find it a bug when the merge message,
notably containing the list of conflicting files, gets clobbered.

Also, I have not checked how git gui reacts, but I would assume that
when carefully and iteratively composing a commit message from there,
which is IIRC managed using .git/COMMIT_EDITMSG, it would not be
desired to get this content clobbered the same way.

To me it looks like the problem is that the commit message in
preparation is not considered precious information, when there are at
least some cases where it indeed should be.  I'm not sure however how
that should be done:

* suddenly claiming it is precious (and require some form of -f to
  clobber it) when it was mostly not is likely to break a number of
  use cases
* looking at the context (are we resolving a merge or similar ?) to
  consider it precious is likely to miss some cases
* declaring a new official location (or API/command ?) to store
  considered-precious message being composed may bring its own lot of
  semantic difficulties

             reply	other threads:[~2012-10-11 20:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 20:50 dirson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-10-11  9:33 [BUG] "git commit" after "cherry-pick -n" conflict clobbers .git/COMMIT_EDITMSG Yann Dirson
2012-10-11 17:00 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121011205035.GB9783@home.lan \
    --to=dirson@bertin.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).