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

Re: [PATCH] sequencer: preserve commit messages

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 26, 2015, 19:49 UTC
Message-ID
<xmqq61aomp1d.fsf@gitster.dls.corp.google.com>
In-Reply-To
<54EEFDF7.8090306@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
> Hmm. With "--edit", current config being in effect should be expected,
> right? So how about:
>
> In case of no conflict: force cleanup=verbatim unless --edit is used?
Perhaps something like that.

Stepping back a bit and imagine a world where the sole purpose of cherry-pick were to recreate the original commit as faithfully as possible. The commit log message would not be cleaned up in such a case by default, and the users need cherrypick.cleanup setting if they do not like that default.

The implementation of cherry-pick that does not spawn the editor in that world would look like this:

    - read the cleanup mode from cherrypick.cleanup config; if there
      is none, read the cleanup mode from commit.cleanup config; if
      neither is defined, then use 'verbatim' as the default;
    - invoke "commit --cleanup=" + that mode from the command line
      to force the mode chosen by the above.

Thanks to the falling back to commit.cleanup, the above logic would be usable even before we invent cherrypick.cleanup configuration, i.e. in today's world. If there is no commit.cleanup defined by the user, the above logic would still use 'verbatim' as the default for 'cherry-pick', while using the 'default' for 'commit'.

When cherry-pick invokes the editor, then the first part would be different. So my conclusion would be something like:

    #if IN_THE_FUTURE
        if (config_exists(cherrypick.cleanup))
            mode = config_value(cherrypick.cleanup);
        else
    #endif
        if (config_exists(commit.cleanup))
            mode = config_value(commit.cleanup);
        else
            mode = editing ? 'verbatim' : 'default';
        invoke "commit --cleanup=" + mode;
perhaps?
Previous: Michael J GruberNext: Michael J Gruber
Message 9 of 14 in “[BUG] git mangles up commit messages on rebase”
  1. Christoph Anton MittererFeb 21, 2015
  2. sequencer: preserve commit messagesMichael J Gruber, Feb 23, 2015
  3. Junio C HamanoFeb 23, 2015
  4. Michael J GruberFeb 24, 2015
  5. Junio C HamanoFeb 24, 2015
  6. Michael J GruberFeb 25, 2015
  7. Junio C HamanoFeb 25, 2015
  8. Michael J GruberFeb 26, 2015
  9. Junio C HamanoFeb 26, 2015
  10. Michael J GruberFeb 27, 2015
  11. Junio C HamanoFeb 27, 2015
  12. [PATCHv2] sequencer: preserve commit messagesMichael J Gruber, Mar 6, 2015
  13. Junio C HamanoMar 6, 2015
  14. Christoph Anton MittererFeb 25, 2015

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.