Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 6e2068a

Browse files
bradkinggitster
authored andcommitted
merge-recursive.c: tolerate missing files while refreshing index
Teach add_cacheinfo to tell make_cache_entry to skip refreshing stat information when a file is missing from the work tree. We do not want the index to be stat-dirty after the merge but also do not want to fail when a file happens to be missing. This fixes the 'merge-recursive w/ empty work tree - ours has rename' case in t3030-merge-recursive. Suggested-by: Elijah Newren <[email protected]> Signed-off-by: Brad King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2576272 commit 6e2068a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

merge-recursive.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ static int add_cacheinfo(unsigned int mode, const unsigned char *sha1,
202202
{
203203
struct cache_entry *ce;
204204
ce = make_cache_entry(mode, sha1 ? sha1 : null_sha1, path, stage,
205-
(refresh ? CE_MATCH_REFRESH : 0 ));
205+
(refresh ? (CE_MATCH_REFRESH |
206+
CE_MATCH_IGNORE_MISSING) : 0 ));
206207
if (!ce)
207208
return error(_("addinfo_cache failed for path '%s'"), path);
208209
return add_cache_entry(ce, options);

t/t3030-merge-recursive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ test_expect_success 'reset and bind merge' '
518518
519519
'
520520

521-
test_expect_failure 'merge-recursive w/ empty work tree - ours has rename' '
521+
test_expect_success 'merge-recursive w/ empty work tree - ours has rename' '
522522
(
523523
GIT_WORK_TREE="$PWD/ours-has-rename-work" &&
524524
export GIT_WORK_TREE &&

0 commit comments

Comments
 (0)