git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Benoit Pierre <benoit.pierre@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Jun Hao <jhao12@bloomberg.net>, git@vger.kernel.org
Subject: Re: [PATCH 4/7] commit: fix patch hunk editing with "commit -p -m"
Date: Tue, 11 Mar 2014 18:56:02 +0100	[thread overview]
Message-ID: <CA+SSzV04KCGyTkFTtSx_9sYAZyh=UzHOPV6tf9JT82w_DsSLHg@mail.gmail.com> (raw)
In-Reply-To: <20140310200756.GC24568@sigill.intra.peff.net>

On Mon, Mar 10, 2014 at 9:07 PM, Jeff King <peff@peff.net> wrote:
> On Mon, Mar 10, 2014 at 07:49:34PM +0100, Benoit Pierre wrote:
>
>> Don't change git environment: move the GIT_EDITOR=":" override to the
>> hook command subprocess, like it's already done for GIT_INDEX_FILE.
>> [...]
>
> This is a lot of change, and in some ways I think it is making things
> better overall. However, the simplest fix for this is basically to move
> the setting of GIT_EDITOR down to after we prepare the index.
>
> Jun Hao (cc'd) has been preparing a series for this based on the
> Bloomberg git hackday a few weeks ago, but it hasn't been sent to the
> list yet.
>
> Commits are here:
>
>   https://github.com/bloomberg/git/compare/commit-patch-allow-hunk-editing
>
> if you care to look. I'm not sure which solution is technically
> superior, but it's worth considering both.
>
> I regret not encouraging Jun to post to the list sooner, as we might
> have avoided some duplicated effort. But that's a sunk cost, and we
> should pick up whichever is the best for the project.

Replying here instead of to Jun Hao message (I'm not subscribed to the
mailing list, so I did not received it):

Jun Hao wrote:
> I like the idea that the environment setting should be done in one
> place. Just not sure run_hook is the right place tho. If user doesn't have
> any hook setup, will this kick in?
> One more question, will this work for dry run? Or dry run doesn't matter
> in this case?

According to the original commit, the change to GIT_EDITOR is only
here for hooks:

commit 406400ce4f69e79b544dd3539a71b85d99331820
Author: Paolo Bonzini <bonzini@gnu.org>
Date:   Tue Feb 5 11:01:45 2008 +0100

    git-commit: set GIT_EDITOR=: if editor will not be launched

    This is a preparatory patch that provides a simple way for the future
    prepare-commit-msg hook to discover if the editor will be launched.

    Signed-off-by: Junio C Hamano <gitster@pobox.com>

So there is really no reason to set it earlier, and not just in the
hook subprocess environment.

Regarding dry run: the bug is present, and my patch fix it too (but is
missing a test for this).

As to which patch is better: it's really not for me to decide! It's a
question for the maintainer(s), Jun Hao patch is sure much smaller and
simpler, mine is more involved and I believe cleaner in the long term:
there is no risk of another part of the commit process to be impacted
by the change of environment. Also note that my patch changes the
merge builtin too: GIT_EDITOR will not be overriden if an editor will
be launched (when used with --edit).

-- 
A: Because it destroys the flow of conversation.
Q: Why is top posting dumb?

  parent reply	other threads:[~2014-03-11 17:56 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 18:49 [PATCH V2 0/7] fix hunk editing with 'commit -p -m' Benoit Pierre
2014-03-10 18:49 ` [PATCH 1/7] merge hook tests: fix missing '&&' in test Benoit Pierre
2014-03-10 18:49 ` [PATCH 2/7] merge hook tests: use 'test_must_fail' instead of '!' Benoit Pierre
2014-03-10 18:49 ` [PATCH 3/7] test patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-10 20:20   ` Eric Sunshine
2014-03-11 18:13     ` Junio C Hamano
2014-03-10 20:30   ` Philip Oakley
2014-03-11 21:03   ` Junio C Hamano
2014-03-15 12:28     ` Torsten Bögershausen
2014-03-15 16:11       ` Benoit Pierre
2014-03-15 21:00         ` Torsten Bögershausen
2014-03-15 21:42         ` [PATCH 1/7] merge hook tests: fix missing '&&' in test Benoit Pierre
2014-03-15 21:42           ` [PATCH 2/7] merge hook tests: use 'test_must_fail' instead of '!' Benoit Pierre
2014-03-15 21:42           ` [PATCH 3/7] test patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-17 18:49             ` Junio C Hamano
2014-03-17 19:46               ` Benoit Pierre
2014-03-17 19:51                 ` Eric Sunshine
2014-03-17 19:53                   ` Benoit Pierre
2014-03-17 21:33                 ` Junio C Hamano
2014-03-17 18:53             ` Junio C Hamano
2014-03-17 19:52               ` Benoit Pierre
2014-03-17 21:35                 ` Junio C Hamano
2014-03-18 10:00               ` [PATCH 1/7] merge hook tests: fix missing '&&' in test Benoit Pierre
2014-03-18 10:00                 ` [PATCH 2/7] merge hook tests: use 'test_must_fail' instead of '!' Benoit Pierre
2014-03-18 10:00                 ` [PATCH 3/7] test patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-18 10:00                 ` [PATCH 4/7] commit: fix " Benoit Pierre
2014-03-19  7:32                   ` Torsten Bögershausen
2014-03-19 17:19                     ` Junio C Hamano
2014-03-18 10:00                 ` [PATCH 5/7] merge: fix GIT_EDITOR override for commit hook Benoit Pierre
2014-03-18 10:00                 ` [PATCH 6/7] merge hook tests: fix and update tests Benoit Pierre
2014-03-18 10:00                 ` [PATCH 7/7] run-command: mark run_hook_with_custom_index as deprecated Benoit Pierre
2014-03-18 18:27                 ` [PATCH 1/7] merge hook tests: fix missing '&&' in test Junio C Hamano
2014-03-15 21:42           ` [PATCH 4/7] commit: fix patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-15 21:42           ` [PATCH 5/7] merge: fix GIT_EDITOR override for commit hook Benoit Pierre
2014-03-15 21:42           ` [PATCH 6/7] merge hook tests: fix and update tests Benoit Pierre
2014-03-15 21:42           ` [PATCH 7/7] run-command: mark run_hook_with_custom_index as deprecated Benoit Pierre
2014-03-10 18:49 ` [PATCH 4/7] commit: fix patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-10 20:07   ` Jeff King
2014-03-11  0:45     ` Jun Hao
2014-03-11 17:56     ` Benoit Pierre [this message]
2014-03-11 18:00       ` Jeff King
2014-03-11 18:40         ` [PATCH 4/7] commit: fix patch hunk editing with Jun Hao
2014-03-11 21:02   ` [PATCH 4/7] commit: fix patch hunk editing with "commit -p -m" Junio C Hamano
2014-03-10 18:49 ` [PATCH 5/7] merge: fix GIT_EDITOR override for commit hook Benoit Pierre
2014-03-10 18:49 ` [PATCH 6/7] merge hook tests: fix and update tests Benoit Pierre
2014-03-10 20:27   ` Eric Sunshine
2014-03-10 18:49 ` [PATCH 7/7] run-command: mark run_hook_with_custom_index as deprecated Benoit Pierre
2014-03-11  1:00   ` brian m. carlson
2014-03-11 17:37     ` Benoit Pierre
2014-04-03 22:11 ` [PATCH V2 0/7] fix hunk editing with 'commit -p -m' Jonathan Nieder

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='CA+SSzV04KCGyTkFTtSx_9sYAZyh=UzHOPV6tf9JT82w_DsSLHg@mail.gmail.com' \
    --to=benoit.pierre@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jhao12@bloomberg.net \
    --cc=peff@peff.net \
    /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).