diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2024-03-15 11:03:10 +1000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-15 10:04:45 -0700 |
commit | 7fdc2656331f051a673a61444051cde58044ceeb (patch) | |
tree | c9435a5630c8fcdf408a64e4c465ace41c8d4790 /t | |
parent | 4f9b731bdeccffa1b13e5edf4bc0428b8d49704e (diff) | |
download | git-7fdc2656331f051a673a61444051cde58044ceeb.tar.gz |
diff: add diff.srcPrefix and diff.dstPrefix configuration variables
Allow the default prefixes "a/" and "b/" to be tweaked by the
diff.srcPrefix and diff.dstPrefix configuration variables.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t4013-diff-various.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 1e3b2dbea4..cfb5ad3d8d 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -663,6 +663,41 @@ test_expect_success 'diff --default-prefix overrides diff.mnemonicprefix' ' check_prefix actual a/file0 b/file0 ' +test_expect_success 'diff respects diff.srcprefix' ' + git -c diff.srcprefix=x/ diff >actual && + check_prefix actual x/file0 b/file0 +' + +test_expect_success 'diff respects diff.dstprefix' ' + git -c diff.dstprefix=y/ diff >actual && + check_prefix actual a/file0 y/file0 +' + +test_expect_success 'diff --src-prefix overrides diff.srcprefix' ' + git -c diff.srcprefix=y/ diff --src-prefix=z/ >actual && + check_prefix actual z/file0 b/file0 +' + +test_expect_success 'diff --dst-prefix overrides diff.dstprefix' ' + git -c diff.dstprefix=y/ diff --dst-prefix=z/ >actual && + check_prefix actual a/file0 z/file0 +' + +test_expect_success 'diff.{src,dst}prefix ignored with diff.noprefix' ' + git -c diff.dstprefix=y/ -c diff.srcprefix=x/ -c diff.noprefix diff >actual && + check_prefix actual file0 file0 +' + +test_expect_success 'diff.{src,dst}prefix ignored with diff.mnemonicprefix' ' + git -c diff.dstprefix=x/ -c diff.srcprefix=y/ -c diff.mnemonicprefix diff >actual && + check_prefix actual i/file0 w/file0 +' + +test_expect_success 'diff.{src,dst}prefix ignored with --default-prefix' ' + git -c diff.dstprefix=x/ -c diff.srcprefix=y/ diff --default-prefix >actual && + check_prefix actual a/file0 b/file0 +' + test_expect_success 'diff --no-renames cannot be abbreviated' ' test_expect_code 129 git diff --no-rename >actual 2>error && test_must_be_empty actual && |