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>
Nguyễn Thái Ngọc Duy committed
Jan 14, 2018 at 17:18 UTC
7db2d08cdccc39ea3d9a1da2da30e54f92b8fd12
1 file changed
+11
-9
read-cache.c
+11
-9
@@ -2474,30 +2474,32 @@ static int clean_shared_index_files(const char *current_hex)
2474
static int write_shared_index(struct index_state *istate,
2475
struct lock_file *lock, unsigned flags)
2476
{
2477
- struct tempfile *temp;
2477
+ struct tempfile *real_temp;
2478
+ struct tempfile **temp = &real_temp;
2479
struct split_index *si = istate->split_index;
2480
int ret;
2481
2481
- temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
2482
- if (!temp) {
2482
+ real_temp = mks_tempfile(git_path("sharedindex_XXXXXX"));
2483
+ if (!real_temp) {
2484
hashclr(si->base_sha1);
2485
return do_write_locked_index(istate, lock, flags);
2486
}
2487
+ temp = &real_temp;
2488
move_cache_to_base_index(istate);
2487
- ret = do_write_index(si->base, temp, 1);
2489
+ ret = do_write_index(si->base, *temp, 1);
2490
if (ret) {
2489
- delete_tempfile(&temp);
2491
+ delete_tempfile(temp);
2492
return ret;
2493
}
2492
- ret = adjust_shared_perm(get_tempfile_path(temp));
2494
+ ret = adjust_shared_perm(get_tempfile_path(*temp));
2495
if (ret) {
2496
int save_errno = errno;
2495
- error("cannot fix permission bits on %s", get_tempfile_path(temp));
2496
- delete_tempfile(&temp);
2497
+ error("cannot fix permission bits on %s", get_tempfile_path(*temp));
2498
+ delete_tempfile(temp);
2499
errno = save_errno;
2500
return ret;
2501
}
2500
- ret = rename_tempfile(&temp,
2502
+ ret = rename_tempfile(temp,
2503
git_path("sharedindex.%s", sha1_to_hex(si->base->sha1)));
2504
if (!ret) {
2505
hashcpy(si->base_sha1, si->base->sha1);