Re: [PATCH v1 14/19] read-cache: touch shared index files when used
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Oct 25, 2016, 10:26 UTC
- Message-ID
- <CACsJy8As2o-ZDXMRWeebpXiWUrDMLaXC2H1R+OMbhAMmM8V_wg@mail.gmail.com>
- In-Reply-To
- <20161023092648.12086-15-chriscool@tuxfamily.org>
On Sun, Oct 23, 2016 at 4:26 PM, Christian Couder <christian.couder@gmail.com> wrote:
> @@ -2268,6 +2268,12 @@ int write_locked_index(struct index_state *istate, struct lock_file *lock,
Doing this in read_index_from() would keep the shared file even more "fresher" since read happens a lot more often than write. But I think our main concern is not the temporary index files created by the user scripts, but $GIT_DIR/index.lock (make sure we don't accidentally delete its shared file before it gets renamed to $GIT_DIR/index). For this case, I think refreshing in write_locked_index is enough.
Show 9 quoted lines
> int ret = write_shared_index(istate, lock, flags);
> if (ret)
> return ret;
> + } else {
> + /* Signal that the shared index is used */
> + const char *shared_index = git_path("sharedindex.%s",
> + sha1_to_hex(si->base_sha1));
> + if (!check_and_freshen_file(shared_index, 1))
> + warning("could not freshen '%s'", shared_index);_()
-- Duy