From: Junio C Hamano <gitster@pobox.com>
To: "Victoria Dye via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, reichemn@icloud.com, Victoria Dye <vdye@github.com>
Subject: Re: [PATCH] mv: refresh stat info for moved entry
Date: Fri, 25 Mar 2022 16:29:32 -0700 [thread overview]
Message-ID: <xmqqk0ch8vc3.fsf@gitster.g> (raw)
In-Reply-To: <pull.1187.git.1648173419533.gitgitgadget@gmail.com> (Victoria Dye via GitGitGadget's message of "Fri, 25 Mar 2022 01:56:59 +0000")
"Victoria Dye via GitGitGadget" <gitgitgadget@gmail.com> writes:
> diff --git a/read-cache.c b/read-cache.c
> index 1ad56d02e1d..2c5ccc48d6c 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -148,6 +148,7 @@ void rename_index_entry_at(struct index_state *istate, int nr, const char *new_n
> untracked_cache_remove_from_index(istate, old_entry->name);
> remove_index_entry_at(istate, nr);
> add_index_entry(istate, new_entry, ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
> + refresh_cache_entry(istate, new_entry, CE_MATCH_REFRESH);
> }
This is a bit unforunate.
If we are renaming "foo" to "bar", I wonder if we can grab the
cached stat info before calling remove_index_entry_at() for "foo"
and copy it to the new entry we create for "bar". After all, we
would be making a corresponding change to rename from "foo" to "bar"
at the filesystem level, too, no?
Well, we are already doing that by calling copy_cache_entry(). So
why do we further need to refresh the cache entry in the first
place? There is something fishy going on, isn't it?
Puzzling...
In any case, refresh_cache_entry() either returns ce or create a
newly allocated entry, so you'd want to first refresh and then the
add the cache entry returned from the function to the index, I
think.
Thanks.
next prev parent reply other threads:[~2022-03-25 23:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 1:56 [PATCH] mv: refresh stat info for moved entry Victoria Dye via GitGitGadget
2022-03-25 14:31 ` Derrick Stolee
2022-03-25 22:37 ` Victoria Dye
2022-03-25 23:29 ` Junio C Hamano [this message]
2022-03-26 1:23 ` Victoria Dye
2022-03-29 1:07 ` [PATCH v2] " Victoria Dye via GitGitGadget
2022-03-29 13:19 ` Derrick Stolee
2022-03-29 16:44 ` Junio C Hamano
2022-03-29 18:54 ` Derrick Stolee
2022-03-29 19:05 ` 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=xmqqk0ch8vc3.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=reichemn@icloud.com \
--cc=vdye@github.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).