Skip to content

Commit 5e9d978

Browse files
committed
Merge branch 'jc/denoise-rm-to-resolve'
"git rm" to resolve a conflicted path leaked an internal message "needs merge" before actually removing the path, which was confusing. This has been corrected. * jc/denoise-rm-to-resolve: rm: resolving by removal is not a warning-worthy event
2 parents f3d508f + b2b1f61 commit 5e9d978

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

builtin/rm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
273273
parse_pathspec(&pathspec, 0,
274274
PATHSPEC_PREFER_CWD,
275275
prefix, argv);
276-
refresh_index(&the_index, REFRESH_QUIET, &pathspec, NULL, NULL);
276+
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &pathspec, NULL, NULL);
277277

278278
seen = xcalloc(pathspec.nr, 1);
279279

t/t3600-rm.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,19 @@ test_expect_success 'choking "git rm" should not let it die with cruft' '
252252
test_path_is_missing .git/index.lock
253253
'
254254

255+
test_expect_success 'Resolving by removal is not a warning-worthy event' '
256+
git reset -q --hard &&
257+
test_when_finished "rm -f .git/index.lock msg && git reset -q --hard" &&
258+
blob=$(echo blob | git hash-object -w --stdin) &&
259+
for stage in 1 2 3
260+
do
261+
echo "100644 $blob $stage blob"
262+
done | git update-index --index-info &&
263+
git rm blob >msg 2>&1 &&
264+
test_i18ngrep ! "needs merge" msg &&
265+
test_must_fail git ls-files -s --error-unmatch blob
266+
'
267+
255268
test_expect_success 'rm removes subdirectories recursively' '
256269
mkdir -p dir/subdir/subsubdir &&
257270
echo content >dir/subdir/subsubdir/file &&

0 commit comments

Comments
 (0)