summaryrefslogtreecommitdiff
path: root/t/lib-diff-alternative.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/lib-diff-alternative.sh')
-rw-r--r--t/lib-diff-alternative.sh31
1 files changed, 26 insertions, 5 deletions
diff --git a/t/lib-diff-alternative.sh b/t/lib-diff-alternative.sh
index a8f5d3274a..c4dc2d46dc 100644
--- a/t/lib-diff-alternative.sh
+++ b/t/lib-diff-alternative.sh
@@ -112,15 +112,36 @@ EOF
STRATEGY=$1
- test_expect_success "$STRATEGY diff from attributes" '
+ test_expect_success "setup attributes files for tests with $STRATEGY" '
+ git checkout -b master &&
echo "file* diff=driver" >.gitattributes &&
- git config diff.driver.algorithm "$STRATEGY" &&
- test_must_fail git diff --no-index file1 file2 > output &&
- cat expect &&
- cat output &&
+ git add file1 file2 .gitattributes &&
+ git commit -m "adding files" &&
+ git checkout -b branchA &&
+ echo "file* diff=driverA" >.gitattributes &&
+ git add .gitattributes &&
+ git commit -m "adding driverA as diff driver" &&
+ git checkout master &&
+ git clone --bare --no-local . bare.git
+ '
+
+ test_expect_success "$STRATEGY diff from attributes" '
+ test_must_fail git -c diff.driver.algorithm=$STRATEGY diff --no-index file1 file2 > output &&
test_cmp expect output
'
+ test_expect_success "diff from attributes with bare repo with source" '
+ git -C bare.git --attr-source=branchA -c diff.driver.algorithm=myers \
+ -c diff.driverA.algorithm=$STRATEGY \
+ diff HEAD:file1 HEAD:file2 >output &&
+ test_cmp expect output
+ '
+
+ test_expect_success "diff from attributes with bare repo with invalid source" '
+ test_must_fail git -C bare.git --attr-source=invalid-branch diff \
+ HEAD:file1 HEAD:file2
+ '
+
test_expect_success "$STRATEGY diff from attributes has valid diffstat" '
echo "file* diff=driver" >.gitattributes &&
git config diff.driver.algorithm "$STRATEGY" &&