summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-01-14 10:18:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-01-16 21:12:02 (GMT)
commit7db2d08cdccc39ea3d9a1da2da30e54f92b8fd12 (patch)
tree6dfc9de5254bec5a8e94af788c26aa4abcc48f67 /read-cache.c
parent0c37383f2ecfce28f67dbc49704ab3755d41eed0 (diff)
downloadgit-7db2d08cdccc39ea3d9a1da2da30e54f92b8fd12.zip
git-7db2d08cdccc39ea3d9a1da2da30e54f92b8fd12.tar.gz
git-7db2d08cdccc39ea3d9a1da2da30e54f92b8fd12.tar.bz2
read-cache.c: change type of "temp" in write_shared_index()
This local variable 'temp' will be passed in from the caller in the next patch. To reduce patch noise, let's change its type now while it's still a local variable and get all the trival conversion out of the next patch. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/read-cache.c b/read-cache.c
index 2eb81a6..536086e 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -2474,30 +2474,32 @@ static int clean_shared_index_files(const char *current_hex)
static int write_shared_index(struct index_state *istate,
struct lock_file *lock, unsigned flags)
{
- struct tempfile *temp;
+ struct tempfile *real_temp;
+ struct tempfile **temp = &real_temp;
struct split_index *si = istate->split_index;
int ret;
- temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
- if (!temp) {
+ real_temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
+ if (!real_temp) {
hashclr(si->base_sha1);
return do_write_locked_index(istate, lock, flags);
}
+ temp = &real_temp;
move_cache_to_base_index(istate);
- ret = do_write_index(si->base, temp, 1);
+ ret = do_write_index(si->base, *temp, 1);
if (ret) {
- delete_tempfile(&temp);
+ delete_tempfile(temp);
return ret;
}
- ret = adjust_shared_perm(get_tempfile_path(temp));
+ ret = adjust_shared_perm(get_tempfile_path(*temp));
if (ret) {
int save_errno = errno;
- error("cannot fix permission bits on %s", get_tempfile_path(temp));
- delete_tempfile(&temp);
+ error("cannot fix permission bits on %s", get_tempfile_path(*temp));
+ delete_tempfile(temp);
errno = save_errno;
return ret;
}
- ret = rename_tempfile(&temp,
+ ret = rename_tempfile(temp,
git_path("sharedindex.%s", sha1_to_hex(si->base->sha1)));
if (!ret) {
hashcpy(si->base_sha1, si->base->sha1);