pack-revindex: use unsigned to store number of objects
[git/mingw.git] / t / t2050-git-dir-relative.sh
blob21f4659a9d1c22fcc8c9eb3261315d67988dad2f
1 #!/bin/sh
3 test_description='check problems with relative GIT_DIR
5 This test creates a working tree state with a file and subdir:
7 top (committed several times)
8 subdir (a subdirectory)
10 It creates a commit-hook and tests it, then moves .git
11 into the subdir while keeping the worktree location,
12 and tries commits from the top and the subdir, checking
13 that the commit-hook still gets called.'
15 . ./test-lib.sh
17 COMMIT_FILE="$(pwd)/output"
18 export COMMIT_FILE
20 test_expect_success 'Setting up post-commit hook' '
21 mkdir -p .git/hooks &&
22 echo >.git/hooks/post-commit "#!/bin/sh
23 touch \"\${COMMIT_FILE}\"
24 echo Post commit hook was called." &&
25 chmod +x .git/hooks/post-commit'
27 test_expect_success 'post-commit hook used ordinarily' '
28 echo initial >top &&
29 git add top &&
30 git commit -m initial &&
31 test -r "${COMMIT_FILE}"
34 rm -rf "${COMMIT_FILE}"
35 mkdir subdir
36 mv .git subdir
38 test_expect_success 'post-commit-hook created and used from top dir' '
39 echo changed >top &&
40 git --git-dir subdir/.git add top &&
41 git --git-dir subdir/.git commit -m topcommit &&
42 test -r "${COMMIT_FILE}"
45 rm -rf "${COMMIT_FILE}"
47 test_expect_success 'post-commit-hook from sub dir' '
48 echo changed again >top &&
49 cd subdir &&
50 git --git-dir .git --work-tree .. add ../top &&
51 git --git-dir .git --work-tree .. commit -m subcommit &&
52 test -r "${COMMIT_FILE}"
55 test_done