Skip to content

Commit a042926

Browse files
committed
fixup! maintenance: care about gvfs.sharedCache config
We need that test case to verify the functionality... Signed-off-by: Johannes Schindelin <[email protected]>
1 parent fe36b13 commit a042926

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

t/t7900-maintenance.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,37 @@ test_expect_success 'maintenance.loose-objects.batchSize' '
353353
test_must_be_empty err
354354
'
355355

356+
test_expect_success 'loose-objects and gvfs.sharedCache' '
357+
git init gvfs-worktree &&
358+
git init --bare gvfs-shared &&
359+
git -C gvfs-worktree config gvfs.sharedCache "$PWD/gvfs-shared/objects" &&
360+
361+
# Hack to stop maintenance from running during "git commit"
362+
echo in use >gvfs-worktree/.git/objects/maintenance.lock &&
363+
git -C gvfs-worktree config maintenance.loose-objects.auto 1 &&
364+
test_commit -C gvfs-worktree create-loose-object &&
365+
rm gvfs-worktree/.git/objects/maintenance.lock &&
366+
! ls -l gvfs-shared/objects/??/* &&
367+
ls -l gvfs-worktree/.git/objects/??/* >loose-objects &&
368+
test_file_not_empty loose-objects &&
369+
! ls -l gvfs-shared/objects/pack/*.pack &&
370+
371+
# move the loose objects into the shared objects as if they had been
372+
# fetched via the `gvfs-helper`
373+
mv gvfs-worktree/.git/objects/?? gvfs-shared/objects/ &&
374+
375+
# Run `loose-objects` twice: The first run creates a pack-file
376+
# but does not delete loose objects, the second run deletes
377+
# loose objects but does not create a pack-file.
378+
git -C gvfs-worktree maintenance run --task=loose-objects &&
379+
git -C gvfs-worktree maintenance run --task=loose-objects &&
380+
381+
! ls -l gvfs-worktree/.git/objects/??/* &&
382+
! ls -l gvfs-shared/.git/objects/??/* &&
383+
ls -l gvfs-shared/objects/pack/*.pack >shared-packs &&
384+
test_file_not_empty shared-packs
385+
'
386+
356387
test_expect_success 'incremental-repack task' '
357388
packDir=.git/objects/pack &&
358389
for i in $(test_seq 1 5)

0 commit comments

Comments
 (0)