git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Nanasy <max.nanasy@gmail.com>
To: git@vger.kernel.org
Subject: Re: [BUG] (git commit --patch --message $MESSAGE) disallows hunk editing
Date: Mon, 29 Sep 2014 23:01:44 +0000 (UTC)	[thread overview]
Message-ID: <loom.20140930T005553-169@post.gmane.org> (raw)
In-Reply-To: CAM998vGieYU+8s1ermDJSfT8Zu8jDRS4WLjypraoB3iOf+qH7g@mail.gmail.com

Max Nanasy <max.nanasy <at> gmail.com> writes:

> 
> Tested against v1.7.12.4
> 
> Steps to reproduce:
> 	A. cd $DIRTY_WORKING_COPY
> 	B. git commit --patch --message $MESSAGE
> 	C. Stage this hunk? e
> Expected behavior:
> 	After step C, the hunk opens in the user's editor
> Actual behavior:
> 	After step C, the hunk is selected unedited (as if the user had entered "y")
> 
> AFAICT, this occurs because of the following code in
> builtin/commit.c:parse_and_validate_options:
> 	if (... || message.len || ...)
> 		use_editor = 0;
> 	...
> 	if (!use_editor)
> 		setenv("GIT_EDITOR", ":", 1);
> Because --message is specified, GIT_EDITOR is set to ":", which
> prevents the user from editing hunks, although the intent is most
> likely to just prevent the user from editing the commit message.
> 

It appears that this was fixed in version 2.0.  The changelog entry says:

 * When it is not necessary to edit a commit log message (e.g. "git
   commit -m" is given a message without specifying "-e"), we used to
   disable the spawning of the editor by overriding GIT_EDITOR, but
   this means all the uses of the editor, other than to edit the
   commit log message, are also affected.
   (merge b549be0 bp/commit-p-editor later to maint).

      parent reply	other threads:[~2014-09-29 23:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23  5:48 [BUG] (git commit --patch --message $MESSAGE) disallows hunk editing Max Nanasy
2014-02-26 15:07 ` Pierre-Olivier Vares
2014-09-29 23:01 ` Max Nanasy [this message]

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

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

  git send-email \
    --in-reply-to=loom.20140930T005553-169@post.gmane.org \
    --to=max.nanasy@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
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 NNTP newsgroup(s).