summaryrefslogtreecommitdiff
path: root/t/t6302-for-each-ref-filter.sh
diff options
context:
space:
mode:
authorNickolai Belakovski <nbelakovski@gmail.com>2019-04-29 05:19:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-07 04:45:53 (GMT)
commit2582083fa1830632e298727e973440907345267f (patch)
tree7bbcd7f3b030eae3e6c93786272b65380afdeb5a /t/t6302-for-each-ref-filter.sh
parent0e94f7aa730b108f7907cfab1b2a7fba965de442 (diff)
downloadgit-2582083fa1830632e298727e973440907345267f.zip
git-2582083fa1830632e298727e973440907345267f.tar.gz
git-2582083fa1830632e298727e973440907345267f.tar.bz2
ref-filter: add worktreepath atom
Add an atom providing the path of the linked worktree where this ref is checked out, if it is checked out in any linked worktrees, and empty string otherwise. Signed-off-by: Nickolai Belakovski <nbelakovski@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6302-for-each-ref-filter.sh')
-rwxr-xr-xt/t6302-for-each-ref-filter.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index fc067ed..35408d5 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -441,4 +441,17 @@ test_expect_success '--merged is incompatible with --no-merged' '
test_must_fail git for-each-ref --merged HEAD --no-merged HEAD
'
+test_expect_success 'validate worktree atom' '
+ cat >expect <<-EOF &&
+ master: $(pwd)
+ master_worktree: $(pwd)/worktree_dir
+ side: not checked out
+ EOF
+ git worktree add -b master_worktree worktree_dir master &&
+ git for-each-ref --format="%(refname:short): %(if)%(worktreepath)%(then)%(worktreepath)%(else)not checked out%(end)" refs/heads/ >actual &&
+ rm -r worktree_dir &&
+ git worktree prune &&
+ test_cmp expect actual
+'
+
test_done