]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1302-repo-version.sh
Several tests: cd inside subshell instead of around
[thirdparty/git.git] / t / t1302-repo-version.sh
CommitLineData
9459aa77
NTND
1#!/bin/sh
2#
3# Copyright (c) 2007 Nguyễn Thái Ngọc Duy
4#
5
6test_description='Test repository version check'
7
8. ./test-lib.sh
9
10cat >test.patch <<EOF
11diff --git a/test.txt b/test.txt
12new file mode 100644
13--- /dev/null
14+++ b/test.txt
15@@ -0,0 +1 @@
16+123
17EOF
18
19test_create_repo "test"
20test_create_repo "test2"
21
22GIT_CONFIG=test2/.git/config git config core.repositoryformatversion 99 || exit 1
23
24test_expect_success 'gitdir selection on normal repos' '
25 (test "$(git config core.repositoryformatversion)" = 0 &&
26 cd test &&
27 test "$(git config core.repositoryformatversion)" = 0)'
28
29# Make sure it would stop at test2, not trash
30test_expect_success 'gitdir selection on unsupported repo' '
31 (cd test2 &&
32 test "$(git config core.repositoryformatversion)" = 99)'
33
34test_expect_success 'gitdir not required mode' '
fd4ec4f2
JL
35 git apply --stat test.patch &&
36 (cd test && git apply --stat ../test.patch) &&
37 (cd test2 && git apply --stat ../test.patch)'
9459aa77
NTND
38
39test_expect_success 'gitdir required mode on normal repos' '
40 (git apply --check --index test.patch &&
41 cd test && git apply --check --index ../test.patch)'
42
41ac414e 43test_expect_success 'gitdir required mode on unsupported repo' '
d492b31c 44 (cd test2 && test_must_fail git apply --check --index ../test.patch)
41ac414e 45'
9459aa77
NTND
46
47test_done