Skip to content

Commit e26e7ca

Browse files
committed
t5310, t5510, t5516: adjust git fetch . in bare repositories
To avoid having to rely on implicit discovery of bare repositories (which will go away at some stage by flipping the default of `safe.bareRepository`), this commit replaces `-C <dir>` with `--git-dir=<dir>`. Since `--git-dir` does not change the working directory, a `.` that formerly referred to the `-C` target must become `..` to reach the same location. The code changes can be validated via this command-line: git diff HEAD^! | awk ' /^diff/,/^\+\+\+/ { next } /^-/ { old[m++] = substr($0, 2) } /^\+/ { line = substr($0,2) # apply: -C X -> --git-dir=X and strip ../ if (match(line, /--git-dir=(.* )\. /, a)) { gsub(/--git-dir=.* \. /, "-C " a[1] ".. ", line) } if (old[n++] != line) print old[n-1] " != " line }' Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent ad141d4 commit e26e7ca

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

t/t5310-pack-bitmaps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ test_bitmap_cases () {
247247
git commit -m "commit with big file" &&
248248
git -c pack.packSizeLimit=500k repack -adb &&
249249
git init --bare no-bitmaps.git &&
250-
git -C no-bitmaps.git fetch .. HEAD
250+
git --git-dir=no-bitmaps.git fetch . HEAD
251251
'
252252

253253
test_expect_success 'set up reusable pack' '

t/t5510-fetch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ test_unpack_limit () {
13751375
git --bare init dest &&
13761376
git -C dest config fetch.unpacklimit $fetch_limit &&
13771377
git -C dest config transfer.unpacklimit $transfer_limit &&
1378-
git -C dest fetch .. onebranch &&
1378+
git --git-dir=dest fetch . onebranch &&
13791379
validate_store_type
13801380
'
13811381
}

t/t5516-fetch-push.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,8 +1829,8 @@ test_expect_success 'refuse fetch to current branch of bare repository worktree'
18291829
git clone --bare . bare.git &&
18301830
git --git-dir=bare.git worktree add bare.git/wt &&
18311831
test_commit banana &&
1832-
test_must_fail git -C bare.git fetch .. HEAD:wt &&
1833-
git -C bare.git fetch -u .. HEAD:wt
1832+
test_must_fail git --git-dir=bare.git fetch . HEAD:wt &&
1833+
git --git-dir=bare.git fetch -u . HEAD:wt
18341834
'
18351835

18361836
test_expect_success 'refuse to push a hidden ref, and make sure do not pollute the repository' '

0 commit comments

Comments
 (0)