]>
git.ipfire.org Git - thirdparty/git.git/blob - t/lib-diff-alternative.sh
1 # Helpers shared by the test scripts for diff algorithms (patience,
12 for(i
= 0; i
< 10; i
++)
14 printf("Your answer is: ");
28 int main
(int argc
, char
**argv
)
41 return fib
(n-1
) + fib
(n-2
);
50 for(i
= 0; i
< 10; i
++)
56 int main
(int argc
, char
**argv
)
62 file1
=$
(git rev-parse
--short $
(git hash-object file1
))
63 file2
=$
(git rev-parse
--short $
(git hash-object file2
))
65 diff --git a/file1 b/file2
66 index $file1..$file2 100644
76 + return fib(n-1) + fib(n-2);
85 for(i = 0; i < 10; i++)
87 - printf("Your answer is: ");
96 - return fact(n-1) * n;
101 int main(int argc, char **argv)
103 - frobnitz(fact(10));
110 test_expect_success
"$STRATEGY diff" '
111 test_must_fail git diff --no-index "--$STRATEGY" file1 file2 > output &&
112 test_cmp expect output
115 test_expect_success
"$STRATEGY diff output is valid" '
117 git apply < output &&
118 test_cmp expect file2
141 uniq1
=$
(git rev-parse
--short $
(git hash-object uniq1
))
142 uniq2
=$
(git rev-parse
--short $
(git hash-object uniq2
))
144 diff --git a/uniq1 b/uniq2
145 index $uniq1..$uniq2 100644
165 test_expect_success
'completely different files' '
166 test_must_fail git diff --no-index "--$STRATEGY" uniq1 uniq2 > output &&
167 test_cmp expect output