git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "git pull" doesn't know "--edit"

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 11, 2012, 20:07 UTC
Message-ID
<CA+55aFwLqvVyMipun4DM4CnbO97Dota3LCM2VPFfLq1LS5a4aQ@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.02.1202111016340.28503@i5.linux-foundation.org>

On Sat, Feb 11, 2012 at 10:21 AM, Linus Torvalds <torvalds@linux-foundation.org> wrote:

>
> Ok, so now "git merge" defaults to editing when interactive - lovely. But
> when testing that,

Ok, I found another thing that seems to be a buglet, or at least an undocumented surprise.

In the docs, the "GIT_MERGE_AUTOEDIT=no" thing is mentioned as the way to get the legacy behavior, which (at least to me) implies that setting it to "yes" gets the modern behavior.

But try this:
    .. create test branch that can be merged ..
    export GIT_MERGE_AUTOEDIT=yes
    git merge test < /dev/null

and notice how the "GIT_MERGE_AUTOEDIT=yes" will actually *override* the automatic merge thing, and will try to start an editor even for non-interactive sessions.

Maybe this is intentional, and not a bug? But it does seem a bit odd - the name is "AUTOEDIT", not "FORCEDEDIT". And at least my default editor gets confused by the redirected input, although obviously if you have a graphical editor in its own window this may well be what you want.

Anyway, maybe the "return v" in default_edit_option() should be
    if (!v)
        return 0;

instead - so that if AUTOEDIT it set to true, it does what the "auto" in the name implies.

Of course, the current behavior *can* actually be useful, exactly as that way to force the editor to come up. So maybe it's just that my expectations that are wrong, and the behavior that "yes" causes a forced editor should just be documented instead.

Or maybe the thing could extend the notion of the current boolean to be a tri-state instead: in addition to the traditional true/yes/on and false/no/off have a "force" mode that is that "always force it on regardless".

And maybe this is just a "nobody cares" situation - "Don't do that then".
                    Linus
Previous: Linus TorvaldsNext: Junio C Hamano
Message 2 of 3 in “"git pull" doesn't know "--edit"”
  1. Linus TorvaldsFeb 11, 2012
  2. Linus TorvaldsFeb 11, 2012
  3. Junio C HamanoFeb 12, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.