{"thread":{"id":"10837","subject":"[PATCH] Call refresh_cache() when updating the user index for --only commits.","startedAt":"2007-11-12T20:48:22Z","lastAt":"2007-11-12T23:01:54Z","messageCount":2,"participants":["Kristian Høgsberg","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"59569","messageId":"1194900502-8987-1-git-send-email-krh@redhat.com","threadId":"10837","inReplyTo":null,"subject":"[PATCH] Call refresh_cache() when updating the user index for --only commits.","fromName":"Kristian Høgsberg","fromEmail":"krh@redhat.com","sentAt":"2007-11-12T20:48:22Z","receivedAt":"2007-11-12T20:48:22Z","isPatch":true,"sender":{"key":"krh@redhat.com","avatar":"https://gravatar.com/avatar/763dee6f9594ac474f725b137a39565792928e583ddf59b32befc2907409027e?d=mp&s=160"},"body":"We're guaranteeing the user that the index will be stat-clean after\ngit commit. Thus, we need to call refresh_cache() for the user index too,\nin the 'git commit <paths>' case.\n\nSigned-off-by: Kristian Høgsberg <krh@redhat.com>\n---\n builtin-commit.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-commit.c b/builtin-commit.c\nindex 5011b8b..35205ef 100644\n--- a/builtin-commit.c\n+++ b/builtin-commit.c\n@@ -109,6 +109,7 @@ static char *prepare_index(const char **files, const char *prefix)\n \n \t/* update the user index file */\n \tadd_files_to_cache(verbose, prefix, files);\n+\trefresh_cache(REFRESH_QUIET);\n \tif (write_cache(fd, active_cache, active_nr) || close(fd))\n \t\tdie(\"unable to write new_index file\");\n \n-- \n1.5.3.5.1762.g9a09d-dirty\n"},{"id":"59593","messageId":"7vmytj1319.fsf@gitster.siamese.dyndns.org","threadId":"10837","inReplyTo":"1194900502-8987-1-git-send-email-krh@redhat.com","subject":"Re: [PATCH] Call refresh_cache() when updating the user index for --only commits.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-12T23:01:54Z","receivedAt":"2007-11-12T23:01:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristian Høgsberg <krh@redhat.com> writes:\n\n> We're guaranteeing the user that the index will be stat-clean after\n> git commit. Thus, we need to call refresh_cache() for the user index too,\n> in the 'git commit <paths>' case.\n>\n> Signed-off-by: Kristian Høgsberg <krh@redhat.com>\n> ---\n>  builtin-commit.c |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>\n> diff --git a/builtin-commit.c b/builtin-commit.c\n> index 5011b8b..35205ef 100644\n> --- a/builtin-commit.c\n> +++ b/builtin-commit.c\n> @@ -109,6 +109,7 @@ static char *prepare_index(const char **files, const char *prefix)\n>  \n>  \t/* update the user index file */\n>  \tadd_files_to_cache(verbose, prefix, files);\n> +\trefresh_cache(REFRESH_QUIET);\n>  \tif (write_cache(fd, active_cache, active_nr) || close(fd))\n>  \t\tdie(\"unable to write new_index file\");\n>  \n\nAh.  This is the real index file that is left for the user after\na partial commit \"git-commit <path>\" returns.\n\nThe other refresh_cache() after this one does not matter if we\ndid not have hook scripts, but it is not very easy to cheaply\ndetect if we are not going to run any hooks so let's leave it\nthere. \n\nThanks.\n"}]}