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

Re: [PATCH v2] builtin-commit: re-read file index before run_status

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 12, 2021, 23:23 UTC
Message-ID
<xmqqpmr5nekx.fsf@gitster.g>
In-Reply-To
<pull.1127.v2.git.git.1636653331034.gitgitgadget@gmail.com>
"Samuel Yvon via GitGitGadget" <gitgitgadget@gmail.com> writes:
> The comment suggesting that the cache must be reset after run_status
> and before the editor being launched was added in ec84bd00,
> (git-commit: Refactor creation of log message., 2008-02-05). It is
> unclear why the run_status must be called *after* the cache reset.

An older thread cited earlier suspected that it is to reflect the changes given to "git commit" proper, excluding whatever pre-commit did, to the return value of run_status(), which becomes the value of committable variable to answer "do we have anything to commit?".

And moving the call would affect both the contents of the status buffer (i.e. the list of paths got changed starts including what pre-commit did) and the "committable" bit by counting such a change as a true change, avoiding the "no empty commit by default" check, in a consistent way, hopefully. I wonder if we have test to demonstrate that, and if there isn't perhaps we would want to add one.

> However, calling run_status after the cache reset does not update
> the status line to state of the current index in the case a
> pre-commit hook is ran and changes files in the staging area.

And if this change also affects the "committable" assignment in a consistent way, it should probably want to be mentioned in this paragraph, too.

I am not convinced by the claim that there is no need for careful transition plans (yet), but I personally agree with the end state (with the above suggested tweaks, that is).

Thanks for working on the topic.
Previous: Samuel Yvon via GitGitGadgetNext: Samuel Yvon
Message 16 of 18 in “builtin-commit: re-read file index before launching editor”
  1. builtin-commit: re-read file index before launching editorSamuel Yvon via GitGitGadget, Nov 9, 2021
  2. Ævar Arnfjörð BjarmasonNov 9, 2021
  3. samuelyvon9@gmail.comNov 9, 2021
  4. Ævar Arnfjörð BjarmasonNov 9, 2021
  5. Samuel YvonNov 9, 2021
  6. Junio C HamanoNov 9, 2021
  7. Samuel YvonNov 9, 2021
  8. Junio C HamanoNov 11, 2021
  9. Description of github.com/git/git, was Re: [PATCH] builtin-commit: re-read file index before launching editorJohannes Schindelin, Nov 9, 2021
  10. Samuel YvonNov 9, 2021
  11. Junio C HamanoNov 9, 2021
  12. Taylor BlauNov 9, 2021
  13. Samuel YvonNov 9, 2021
  14. Johannes SchindelinNov 10, 2021
  15. builtin-commit: re-read file index before run_statusSamuel Yvon via GitGitGadget, Nov 11, 2021
  16. Junio C HamanoNov 12, 2021
  17. Samuel YvonNov 17, 2021
  18. Junio C HamanoNov 18, 2021

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.