git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Samuel Yvon via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Taylor Blau" <me@ttaylorr.com>,
	"Samuel Yvon" <samuelyvon9@gmail.com>
Subject: Re: [PATCH v2] builtin-commit: re-read file index before run_status
Date: Fri, 12 Nov 2021 15:23:26 -0800	[thread overview]
Message-ID: <xmqqpmr5nekx.fsf@gitster.g> (raw)
In-Reply-To: <pull.1127.v2.git.git.1636653331034.gitgitgadget@gmail.com> (Samuel Yvon via GitGitGadget's message of "Thu, 11 Nov 2021 17:55:30 +0000")

"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.

  reply	other threads:[~2021-11-12 23:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09  2:06 [PATCH] builtin-commit: re-read file index before launching editor Samuel Yvon via GitGitGadget
2021-11-09  2:32 ` Ævar Arnfjörð Bjarmason
2021-11-09  3:08   ` samuelyvon9
2021-11-09  9:11     ` Ævar Arnfjörð Bjarmason
2021-11-09 15:22       ` Samuel Yvon
2021-11-09 18:36         ` Junio C Hamano
2021-11-09 20:01           ` Samuel Yvon
2021-11-11 22:09             ` Junio C Hamano
2021-11-09 16:41 ` Description of github.com/git/git, was " Johannes Schindelin
2021-11-09 17:01   ` Samuel Yvon
2021-11-09 19:03   ` Junio C Hamano
2021-11-09 19:23     ` Taylor Blau
2021-11-09 19:27     ` Samuel Yvon
2021-11-10 12:22       ` Johannes Schindelin
2021-11-11 17:55 ` [PATCH v2] builtin-commit: re-read file index before run_status Samuel Yvon via GitGitGadget
2021-11-12 23:23   ` Junio C Hamano [this message]
2021-11-17 16:48     ` Samuel Yvon
2021-11-18 23:51       ` Junio C Hamano

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=xmqqpmr5nekx.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=me@ttaylorr.com \
    --cc=samuelyvon9@gmail.com \
    /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).