public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Jialong Wang <jerrywang183@yahoo.com>
To: git@vger.kernel.org
Subject: [PATCH] t1900: cover linked worktrees and separate git dirs
Date: Wed, 18 Mar 2026 16:35:47 -0400	[thread overview]
Message-ID: <20260318203547.39972-1-jerrywang183@yahoo.com> (raw)
In-Reply-To: 20260318203547.39972-1-jerrywang183.ref@yahoo.com

Add repo-info coverage for repositories accessed through a linked\nworktree and through a worktree created with --separate-git-dir.\n\nThese layouts are already supported by the current implementation, but\nare not exercised by t1900-repo-info.sh yet. Cover both the lines and\nnul output formats for layout.bare and layout.shallow in these cases.

Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>
---
 t/t1900-repo-info.sh | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh
index a9eb07abe8..f85ed232c2 100755
--- a/t/t1900-repo-info.sh
+++ b/t/t1900-repo-info.sh
@@ -69,6 +69,45 @@ test_repo_info 'object.format = sha1 is retrieved correctly' \
 test_repo_info 'object.format = sha256 is retrieved correctly' \
 	'git init --object-format=sha256' 'sha256' 'object.format' 'sha256'
 
+test_expect_success 'setup linked worktree' '
+	git init main &&
+	git -C main worktree add ../linked
+'
+
+test_expect_success 'linked worktree layout values are retrieved correctly in lines format' '
+	cat >expect <<-\EOF &&
+	layout.bare=false
+	layout.shallow=false
+	EOF
+	git -C linked repo info layout.bare layout.shallow >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'linked worktree layout values are retrieved correctly in nul format' '
+	printf "layout.bare\nfalse\0layout.shallow\nfalse\0" >expect &&
+	git -C linked repo info --format=nul layout.bare layout.shallow >actual &&
+	test_cmp_bin expect actual
+'
+
+test_expect_success 'setup repository created with --separate-git-dir' '
+	git init --separate-git-dir=separate.git separate-worktree
+'
+
+test_expect_success 'separate-git-dir layout values are retrieved correctly in lines format' '
+	cat >expect <<-\EOF &&
+	layout.bare=false
+	layout.shallow=false
+	EOF
+	git -C separate-worktree repo info layout.bare layout.shallow >actual &&
+	test_cmp expect actual
+'
+
+test_expect_success 'separate-git-dir layout values are retrieved correctly in nul format' '
+	printf "layout.bare\nfalse\0layout.shallow\nfalse\0" >expect &&
+	git -C separate-worktree repo info --format=nul layout.bare layout.shallow >actual &&
+	test_cmp_bin expect actual
+'
+
 test_expect_success 'values returned in order requested' '
 	cat >expect <<-\EOF &&
 	layout.bare=false
-- 
2.51.0


       reply	other threads:[~2026-03-18 20:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260318203547.39972-1-jerrywang183.ref@yahoo.com>
2026-03-18 20:35 ` Jialong Wang [this message]
2026-03-21 18:32   ` [PATCH] t1900: cover linked worktrees and separate git dirs Tian Yuchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260318203547.39972-1-jerrywang183@yahoo.com \
    --to=jerrywang183@yahoo.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox