]>
Commit | Line | Data |
---|---|---|
9459aa77 NTND |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Nguyễn Thái Ngọc Duy | |
4 | # | |
5 | ||
6 | test_description='Test repository version check' | |
7 | ||
8 | . ./test-lib.sh | |
9 | ||
8fe5aedd JN |
10 | test_expect_success 'setup' ' |
11 | cat >test.patch <<-\EOF && | |
12 | diff --git a/test.txt b/test.txt | |
13 | new file mode 100644 | |
14 | --- /dev/null | |
15 | +++ b/test.txt | |
16 | @@ -0,0 +1 @@ | |
17 | +123 | |
18 | EOF | |
9459aa77 | 19 | |
8fe5aedd JN |
20 | test_create_repo "test" && |
21 | test_create_repo "test2" && | |
22 | GIT_CONFIG=test2/.git/config git config core.repositoryformatversion 99 | |
23 | ' | |
9459aa77 NTND |
24 | |
25 | test_expect_success 'gitdir selection on normal repos' ' | |
8fe5aedd JN |
26 | echo 0 >expect && |
27 | git config core.repositoryformatversion >actual && | |
28 | ( | |
29 | cd test && | |
30 | git config core.repositoryformatversion >../actual2 | |
31 | ) && | |
32 | test_cmp expect actual && | |
33 | test_cmp expect actual2 | |
34 | ' | |
9459aa77 | 35 | |
9459aa77 | 36 | test_expect_success 'gitdir selection on unsupported repo' ' |
8fe5aedd JN |
37 | # Make sure it would stop at test2, not trash |
38 | echo 99 >expect && | |
39 | ( | |
40 | cd test2 && | |
41 | git config core.repositoryformatversion >../actual | |
a48fcd83 | 42 | ) && |
8fe5aedd JN |
43 | test_cmp expect actual |
44 | ' | |
9459aa77 NTND |
45 | |
46 | test_expect_success 'gitdir not required mode' ' | |
fd4ec4f2 | 47 | git apply --stat test.patch && |
18a82692 JN |
48 | ( |
49 | cd test && | |
50 | git apply --stat ../test.patch | |
51 | ) && | |
52 | ( | |
53 | cd test2 && | |
54 | git apply --stat ../test.patch | |
55 | ) | |
56 | ' | |
9459aa77 | 57 | |
8fe5aedd JN |
58 | test_expect_success 'gitdir required mode' ' |
59 | git apply --check --index test.patch && | |
60 | ( | |
61 | cd test && | |
62 | git apply --check --index ../test.patch | |
63 | ) && | |
64 | ( | |
65 | cd test2 && | |
66 | test_must_fail git apply --check --index ../test.patch | |
67 | ) | |
41ac414e | 68 | ' |
9459aa77 NTND |
69 | |
70 | test_done |