diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-01-16 12:07:46 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-01-16 12:07:46 -0800 |
| commit | 1120c54c12788c232d96702702e719f72e7ece14 (patch) | |
| tree | c639799d3b9e8fec8c9157f8a6a788049fbac14f /t | |
| parent | Merge branch 'ds/bundle-uri-4' (diff) | |
| parent | diff: drop "name" parameter from prepare_temp_file() (diff) | |
| download | git-1120c54c12788c232d96702702e719f72e7ece14.tar.gz git-1120c54c12788c232d96702702e719f72e7ece14.zip | |
Merge branch 'jk/ext-diff-with-relative'
"git diff --relative" did not mix well with "git diff --ext-diff",
which has been corrected.
* jk/ext-diff-with-relative:
diff: drop "name" parameter from prepare_temp_file()
diff: clean up external-diff argv setup
diff: use filespec path to set up tempfiles for ext-diff
Diffstat (limited to 't')
| -rwxr-xr-x | t/t4045-diff-relative.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh index 198dfc9190..9b46c4c1be 100755 --- a/t/t4045-diff-relative.sh +++ b/t/t4045-diff-relative.sh @@ -164,6 +164,35 @@ check_diff_relative_option subdir file2 true --no-relative --relative check_diff_relative_option . file2 false --no-relative --relative=subdir check_diff_relative_option . file2 true --no-relative --relative=subdir +test_expect_success 'external diff with --relative' ' + test_when_finished "git reset --hard" && + echo changed >file1 && + echo changed >subdir/file2 && + + write_script mydiff <<-\EOF && + # hacky pretend diff; the goal here is just to make sure we got + # passed sensible input that we _could_ diff, without relying on + # the specific output of a system diff tool. + echo "diff a/$1 b/$1" && + echo "--- a/$1" && + echo "+++ b/$1" && + echo "@@ -1 +0,0 @@" && + sed "s/^/-/" "$2" && + sed "s/^/+/" "$5" + EOF + + cat >expect <<-\EOF && + diff a/file2 b/file2 + --- a/file2 + +++ b/file2 + @@ -1 +0,0 @@ + -other content + +changed + EOF + GIT_EXTERNAL_DIFF=./mydiff git diff --relative=subdir >actual && + test_cmp expect actual +' + test_expect_success 'setup diff --relative unmerged' ' test_commit zero file0 && test_commit base subdir/file0 && |
