Subject: Re: [PATCH v3 23/32] prune: strategies for linked checkouts

From: Johannes Sixt <[email-masked]>
Date: Wed, 01 Oct 2014 18:20:35 +0200

Am 28.09.2014 um 03:22 schrieb Nguyễn Thái Ngọc Duy:
> +test_expect_success 'prune directories with gitdir pointing to nowhere' '
> +	mkdir -p .git/worktrees/def/abc &&
> +	: >.git/worktrees/def/def &&
> +	echo "$TRASH_DIRECTORY"/nowhere >.git/worktrees/def/gitdir &&
> +	git prune --worktrees --verbose >actual &&
> +	test_i18ngrep "Removing worktrees/def: gitdir file points to non-existent location" actual &&
> +	! test -d .git/worktrees/def &&
> +	! test -d .git/worktrees
> +'
> ...
> +test_expect_success 'not prune recent checkouts' '
> +	test_when_finished rm -r .git/worktrees
> +	mkdir zz &&
> +	mkdir -p .git/worktrees/jlm &&
> +	echo "$TRASH_DIRECTORY"/zz >.git/worktrees/jlm/gitdir &&
> +	git prune --worktrees --verbose --expire=2.days.ago &&
> +	test -d .git/worktrees/jlm
> +'

These require the following fixups because MinGW git will understand
only DOS style absolute paths, but $TRASH_DIRECTORY is in
POSIX-MSYS-style /c/foo/bar.

--- 8< ---
Subject: [PATCH] fixup! prune: strategies for linked checkouts

Signed-off-by: Johannes Sixt <[email-masked]>
---
 t/t2026-prune-linked-checkouts.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t2026-prune-linked-checkouts.sh b/t/t2026-prune-linked-checkouts.sh
index 3622800..170aefe 100755
--- a/t/t2026-prune-linked-checkouts.sh
+++ b/t/t2026-prune-linked-checkouts.sh
@@ -57,7 +57,7 @@ test_expect_success 'prune directories with invalid gitdir' '
 test_expect_success 'prune directories with gitdir pointing to nowhere' '
 	mkdir -p .git/worktrees/def/abc &&
 	: >.git/worktrees/def/def &&
-	echo "$TRASH_DIRECTORY"/nowhere >.git/worktrees/def/gitdir &&
+	echo "$(pwd)"/nowhere >.git/worktrees/def/gitdir &&
 	git prune --worktrees --verbose >actual &&
 	test_i18ngrep "Removing worktrees/def: gitdir file points to non-existent location" actual &&
 	! test -d .git/worktrees/def &&
@@ -76,7 +76,7 @@ test_expect_success 'not prune recent checkouts' '
 	test_when_finished rm -r .git/worktrees
 	mkdir zz &&
 	mkdir -p .git/worktrees/jlm &&
-	echo "$TRASH_DIRECTORY"/zz >.git/worktrees/jlm/gitdir &&
+	echo "$(pwd)"/zz >.git/worktrees/jlm/gitdir &&
 	git prune --worktrees --verbose --expire=2.days.ago &&
 	test -d .git/worktrees/jlm
 '
-- 
2.0.0.12.gbcf935e