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

Re: [PATCH] Call refresh_cache() when updating the user index for --only commits.

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 12, 2007, 23:01 UTC
Message-ID
<7vmytj1319.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1194900502-8987-1-git-send-email-krh@redhat.com>
Kristian Høgsberg <krh@redhat.com> writes:
Show 21 quoted lines
> We're guaranteeing the user that the index will be stat-clean after
> git commit. Thus, we need to call refresh_cache() for the user index too,
> in the 'git commit <paths>' case.
>
> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
> ---
>  builtin-commit.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/builtin-commit.c b/builtin-commit.c
> index 5011b8b..35205ef 100644
> --- a/builtin-commit.c
> +++ b/builtin-commit.c
> @@ -109,6 +109,7 @@ static char *prepare_index(const char **files, const char *prefix)
>  
>  	/* update the user index file */
>  	add_files_to_cache(verbose, prefix, files);
> +	refresh_cache(REFRESH_QUIET);
>  	if (write_cache(fd, active_cache, active_nr) || close(fd))
>  		die("unable to write new_index file");
>  

Ah. This is the real index file that is left for the user after a partial commit "git-commit <path>" returns.

The other refresh_cache() after this one does not matter if we did not have hook scripts, but it is not very easy to cheaply detect if we are not going to run any hooks so let's leave it there.

Thanks.
Previous: Kristian Høgsberg
Message 2 of 2 in “Call refresh_cache() when updating the user index for --only commits.”
  1. Call refresh_cache() when updating the user index for --only commits.Kristian Høgsberg, Nov 12, 2007
  2. Junio C HamanoNov 12, 2007

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.