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

Re: [PATCH 3/4] git-commit: Refactor creation of log message.

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 5, 2008, 01:39 UTC
Message-ID
<7vzluggp0q.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<47A747EB.9020909@gnu.org>
Paolo Bonzini <bonzini@gnu.org> writes:
Show 17 quoted lines
> Johannes Schindelin wrote:
>>
>> On Mon, 21 Jan 2008, Paolo Bonzini wrote:
>>
>>> This means that: 1) the commit may be aborted after editing the message
>>> if there is a problem writing out the tree object (slight disadvantage);
>>
>> I consider this more than a slight disadvantage.  I regularly take
>> ages coming up with a good commit message, because I think that the
>> overall time balance is better with me spending more time on the
>> message, but every reader spending less time to guess what I meant.
>>
>> So I would be quite annoyed to edit a message, only to find out that
>> for whatever reason the commit was not successful.
>
> Just to make it clearer, the piece of code that would have to fail,
> for the behavior to change, is this:

I suspect Dscho was worried about the case where he says "git commit", types message and then write-tree finds out that the index is still unmerged and the tree cannot be written out.

And I'd be majorly annoyed if the "slight disadvange" was about that.

Show 9 quoted lines
>         discard_cache();
>         read_cache_from(index_file);
>         if (!active_cache_tree)
>                 active_cache_tree = cache_tree();
>         if (cache_tree_update(active_cache_tree,
>                               active_cache, active_nr, 0, 0) < 0) {
>                 rollback_index_files();
>                 die("Error building trees");
>         }
I think this _could_ error out if your index is unmerged.

However, if you have other code to error out early upon unmeregd index before you collect the message from the editor, I think you are Ok.

Previous: Paolo BonziniNext: Junio C Hamano
Message 11 of 13 in “git-commit: add a prepare-commit-msg hook”
  1. git-commit: add a prepare-commit-msg hookPaolo Bonzini, Jan 21, 2008
  2. 1/4 git-commit: support variable number of hook argumentsPaolo Bonzini, Jan 21, 2008
  3. Johannes SchindelinFeb 4, 2008
  4. Junio C HamanoFeb 5, 2008
  5. 2/4 git-commit: set GIT_EDITOR=: if editor will not be launchedPaolo Bonzini, Jan 21, 2008
  6. 4/4 git-commit: add a prepare-commit-msg hookPaolo Bonzini, Jan 21, 2008
  7. Junio C HamanoFeb 5, 2008
  8. 3/4 git-commit: Refactor creation of log message.Paolo Bonzini, Jan 21, 2008
  9. Johannes SchindelinFeb 4, 2008
  10. Paolo BonziniFeb 4, 2008
  11. Junio C HamanoFeb 5, 2008
  12. Junio C HamanoFeb 5, 2008
  13. Paolo BonziniFeb 5, 2008

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.