Skip to content

Commit 8034893

Browse files
committed
tests: unset GIT_DIR after leaving bare repo context
Earlier commits in this series export `GIT_DIR` when entering bare repositories. When the test subsequently leaves that context via `cd`, the stale `GIT_DIR` must be cleaned up to avoid confusing subsequent commands. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 3810e35 commit 8034893

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

t/t1400-update-ref.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ test_expect_success setup '
3232
cd $bare &&
3333
git init --bare -b main &&
3434
create_test_commits "bare" &&
35-
cd -
35+
cd - && sane_unset GIT_DIR
3636
'
3737

3838
test_expect_success "create $m" '

t/t1800-hook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ test_expect_success 'server hooks expect stdout redirected to stderr' '
535535
git remote add origin-server remote-server &&
536536
cd remote-server &&
537537
setup_hooks pre-receive update post-receive post-update &&
538-
cd .. &&
538+
cd .. && sane_unset GIT_DIR &&
539539
git push origin-server HEAD:new-branch >stdout.actual 2>stderr.actual &&
540540
check_stdout_merged_to_stderr pre-receive update post-receive post-update
541541
'

t/t2400-worktree-add.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ test_expect_success '"add" to bare repo with worktree config' '
219219
git config --worktree bogus.key value &&
220220
git config --unset core.bare &&
221221
git worktree add ../there4 main &&
222-
cd ../there4 &&
222+
cd ../there4 && sane_unset GIT_DIR &&
223223
224224
# Simple check that a Git command does not
225225
# immediately fail with the current setup

t/t5500-fetch-pack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ test_expect_success 'fetch in shallow repo unreachable shallow objects' '
458458
git tag -d TAGB1 TAGB2 &&
459459
git update-ref refs/heads/B B~~ &&
460460
git gc --prune=now &&
461-
cd ../shallow9 &&
461+
cd ../shallow9 && sane_unset GIT_DIR &&
462462
git fetch origin &&
463463
git fsck --no-dangling
464464
)

0 commit comments

Comments
 (0)