Merge branch 'hd/diff-no-index-reverse-fix' into seen
A bug in git diff --no-index that mishandled reverse (-R) output when conflicts existed between a file and a directory has been fixed. * hd/diff-no-index-reverse-fix: diff --no-index: fix -R with file/directory conflictsseen
commit
ad07217cb8
|
|
@ -188,6 +188,8 @@ static int queue_diff(struct diff_options *o, const struct git_hash_algo *algop,
|
|||
mode1 = 0;
|
||||
}
|
||||
/* emit that file */
|
||||
if (o->flags.reverse_diff)
|
||||
SWAP(d1, d2);
|
||||
diff_queue(&diff_queued_diff, d1, d2);
|
||||
|
||||
/* and then let the entire directory be created or deleted */
|
||||
|
|
|
|||
|
|
@ -120,6 +120,24 @@ test_expect_success 'turning a file into a directory' '
|
|||
)
|
||||
'
|
||||
|
||||
test_expect_success 'reverse diff when turning a file into a directory' '
|
||||
(
|
||||
cd non/git &&
|
||||
printf "A\td/sub\nD\te/sub/file\n" >expect &&
|
||||
test_expect_code 1 git diff --no-index -R --name-status d e >actual &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'reverse diff when turning a directory into a file' '
|
||||
(
|
||||
cd non/git &&
|
||||
printf "D\td/sub\nA\te/sub/file\n" >expect &&
|
||||
test_expect_code 1 git diff --no-index -R --name-status e d >actual &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'diff from repo subdir shows real paths (explicit)' '
|
||||
echo "diff --git a/../../non/git/a b/../../non/git/b" >expect &&
|
||||
test_expect_code 1 \
|
||||
|
|
|
|||
Loading…
Reference in New Issue