Skip to content

Commit

Permalink
diff-index: report unmerged new entries
Browse files Browse the repository at this point in the history
Since an earlier change to diff-index by d1f2d7e (Make run_diff_index()
use unpack_trees(), not read_tree(), 2008-01-19), we stopped reporting an
unmerged path that does not exist in the tree, but we should.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Aug 5, 2009
1 parent 07a4a3b commit 29796c6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diff-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
match_missing = !revs->ignore_merges;

if (cached && idx && ce_stage(idx)) {
if (tree)
diff_unmerge(&revs->diffopt, idx->name, idx->ce_mode, idx->sha1);
diff_unmerge(&revs->diffopt, idx->name, idx->ce_mode,
idx->sha1);
return;
}

Expand Down
31 changes: 31 additions & 0 deletions t/t7060-wtstatus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

test_description='basic work tree status reporting'

. ./test-lib.sh

test_expect_success setup '
test_commit A &&
test_commit B oneside added &&
git checkout A^0 &&
test_commit C oneside created
'

test_expect_success 'A/A conflict' '
git checkout B^0 &&
test_must_fail git merge C
'

test_expect_success 'Report path with conflict' '
git diff --cached --name-status >actual &&
echo "U oneside" >expect &&
test_cmp expect actual
'

test_expect_success 'Report new path with conflict' '
git diff --cached --name-status HEAD^ >actual &&
echo "U oneside" >expect &&
test_cmp expect actual
'

test_done

0 comments on commit 29796c6

Please sign in to comment.