File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -308,4 +308,24 @@ test_expect_success SYMLINKS 'pack symlinked packed-refs' '
308
308
test "$(test_readlink .git/packed-refs)" = "my-deviant-packed-refs"
309
309
'
310
310
311
+ # The 'packed-refs' file is stored directly in .git/. This means it is global
312
+ # to the repository, and can only contain refs that are shared across all
313
+ # worktrees.
314
+ test_expect_success ' refs/worktree must not be packed' '
315
+ test_commit initial &&
316
+ test_commit wt1 &&
317
+ test_commit wt2 &&
318
+ git worktree add wt1 wt1 &&
319
+ git worktree add wt2 wt2 &&
320
+ git checkout initial &&
321
+ git update-ref refs/worktree/foo HEAD &&
322
+ git -C wt1 update-ref refs/worktree/foo HEAD &&
323
+ git -C wt2 update-ref refs/worktree/foo HEAD &&
324
+ git pack-refs --all &&
325
+ test_path_is_missing .git/refs/tags/wt1 &&
326
+ test_path_is_file .git/refs/worktree/foo &&
327
+ test_path_is_file .git/worktrees/wt1/refs/worktree/foo &&
328
+ test_path_is_file .git/worktrees/wt2/refs/worktree/foo
329
+ '
330
+
311
331
test_done
Original file line number Diff line number Diff line change @@ -17,17 +17,6 @@ test_expect_success 'setup' '
17
17
git -C wt2 update-ref refs/worktree/foo HEAD
18
18
'
19
19
20
- # The 'packed-refs' file is stored directly in .git/. This means it is global
21
- # to the repository, and can only contain refs that are shared across all
22
- # worktrees.
23
- test_expect_success REFFILES ' refs/worktree must not be packed' '
24
- git pack-refs --all &&
25
- test_path_is_missing .git/refs/tags/wt1 &&
26
- test_path_is_file .git/refs/worktree/foo &&
27
- test_path_is_file .git/worktrees/wt1/refs/worktree/foo &&
28
- test_path_is_file .git/worktrees/wt2/refs/worktree/foo
29
- '
30
-
31
20
test_expect_success ' refs/worktree are per-worktree' '
32
21
test_cmp_rev worktree/foo initial &&
33
22
( cd wt1 && test_cmp_rev worktree/foo wt1 ) &&
You can’t perform that action at this time.
0 commit comments