{"thread":{"id":"65294","subject":"[PATCH] t1900: cover linked worktrees and separate git dirs","startedAt":"2026-03-18T20:35:50Z","lastAt":"2026-03-21T18:32:53Z","messageCount":2,"participants":["Jialong Wang","Tian Yuchen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"539321","messageId":"20260318203547.39972-1-jerrywang183@yahoo.com","threadId":"65294","inReplyTo":"20260318203547.39972-1-jerrywang183.ref@yahoo.com","subject":"[PATCH] t1900: cover linked worktrees and separate git dirs","fromName":"Jialong Wang","fromEmail":"jerrywang183@yahoo.com","sentAt":"2026-03-18T20:35:47Z","receivedAt":"2026-03-18T20:35:50Z","isPatch":true,"sender":{"key":"jerrywang183@yahoo.com","avatar":null},"body":"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.\n\nSigned-off-by: Jialong Wang <jerrywang183@yahoo.com>\n---\n t/t1900-repo-info.sh | 39 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 39 insertions(+)\n\ndiff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh\nindex a9eb07abe8..f85ed232c2 100755\n--- a/t/t1900-repo-info.sh\n+++ b/t/t1900-repo-info.sh\n@@ -69,6 +69,45 @@ test_repo_info 'object.format = sha1 is retrieved correctly' \\\n test_repo_info 'object.format = sha256 is retrieved correctly' \\\n \t'git init --object-format=sha256' 'sha256' 'object.format' 'sha256'\n \n+test_expect_success 'setup linked worktree' '\n+\tgit init main &&\n+\tgit -C main worktree add ../linked\n+'\n+\n+test_expect_success 'linked worktree layout values are retrieved correctly in lines format' '\n+\tcat >expect <<-\\EOF &&\n+\tlayout.bare=false\n+\tlayout.shallow=false\n+\tEOF\n+\tgit -C linked repo info layout.bare layout.shallow >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'linked worktree layout values are retrieved correctly in nul format' '\n+\tprintf \"layout.bare\\nfalse\\0layout.shallow\\nfalse\\0\" >expect &&\n+\tgit -C linked repo info --format=nul layout.bare layout.shallow >actual &&\n+\ttest_cmp_bin expect actual\n+'\n+\n+test_expect_success 'setup repository created with --separate-git-dir' '\n+\tgit init --separate-git-dir=separate.git separate-worktree\n+'\n+\n+test_expect_success 'separate-git-dir layout values are retrieved correctly in lines format' '\n+\tcat >expect <<-\\EOF &&\n+\tlayout.bare=false\n+\tlayout.shallow=false\n+\tEOF\n+\tgit -C separate-worktree repo info layout.bare layout.shallow >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'separate-git-dir layout values are retrieved correctly in nul format' '\n+\tprintf \"layout.bare\\nfalse\\0layout.shallow\\nfalse\\0\" >expect &&\n+\tgit -C separate-worktree repo info --format=nul layout.bare layout.shallow >actual &&\n+\ttest_cmp_bin expect actual\n+'\n+\n test_expect_success 'values returned in order requested' '\n \tcat >expect <<-\\EOF &&\n \tlayout.bare=false\n-- \n2.51.0\n\n"},{"id":"539610","messageId":"0b4dee1e-5a85-4863-9538-8c3bbf8e9aef@malon.dev","threadId":"65294","inReplyTo":"20260318203547.39972-1-jerrywang183@yahoo.com","subject":"Re: [PATCH] t1900: cover linked worktrees and separate git dirs","fromName":"Tian Yuchen","fromEmail":"cat@malon.dev","sentAt":"2026-03-21T18:32:47Z","receivedAt":"2026-03-21T18:32:53Z","isPatch":true,"sender":{"key":"cat@malon.dev","avatar":"https://avatars.githubusercontent.com/u/232002048?v=4"},"body":"Hi Jialong,\n\nThanks for the patch.\n\nOn 3/19/26 04:35, Jialong Wang wrote:\n> 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.\n> \n> Signed-off-by: Jialong Wang <jerrywang183@yahoo.com>\n> ---\n\nI noticed that line breaks in the submitted data are escaped as \\n \ncharacters. Even if you send the patch using a different tool, you \nshould still check the mailing list to see how it looks, right? ;)\n\n>   t/t1900-repo-info.sh | 39 +++++++++++++++++++++++++++++++++++++++\n>   1 file changed, 39 insertions(+)\n> \n> diff --git a/t/t1900-repo-info.sh b/t/t1900-repo-info.sh\n> index a9eb07abe8..f85ed232c2 100755\n> --- a/t/t1900-repo-info.sh\n> +++ b/t/t1900-repo-info.sh\n> @@ -69,6 +69,45 @@ test_repo_info 'object.format = sha1 is retrieved correctly' \\\n>   test_repo_info 'object.format = sha256 is retrieved correctly' \\\n>   \t'git init --object-format=sha256' 'sha256' 'object.format' 'sha256'\n>   \n> +test_expect_success 'setup linked worktree' '\n> +\tgit init main &&\n> +\tgit -C main worktree add ../linked\n> +'\n> +\n> +test_expect_success 'linked worktree layout values are retrieved correctly in lines format' '\n> +\tcat >expect <<-\\EOF &&\n> +\tlayout.bare=false\n> +\tlayout.shallow=false\n> +\tEOF\n> +\tgit -C linked repo info layout.bare layout.shallow >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n> +test_expect_success 'linked worktree layout values are retrieved correctly in nul format' '\n> +\tprintf \"layout.bare\\nfalse\\0layout.shallow\\nfalse\\0\" >expect &&\n> +\tgit -C linked repo info --format=nul layout.bare layout.shallow >actual &&\n> +\ttest_cmp_bin expect actual\n> +'\n> +\n> +test_expect_success 'setup repository created with --separate-git-dir' '\n> +\tgit init --separate-git-dir=separate.git separate-worktree\n> +'\n> +\n> +test_expect_success 'separate-git-dir layout values are retrieved correctly in lines format' '\n> +\tcat >expect <<-\\EOF &&\n> +\tlayout.bare=false\n> +\tlayout.shallow=false\n> +\tEOF\n> +\tgit -C separate-worktree repo info layout.bare layout.shallow >actual &&\n> +\ttest_cmp expect actual\n> +'\n> +\n> +test_expect_success 'separate-git-dir layout values are retrieved correctly in nul format' '\n> +\tprintf \"layout.bare\\nfalse\\0layout.shallow\\nfalse\\0\" >expect &&\n> +\tgit -C separate-worktree repo info --format=nul layout.bare layout.shallow >actual &&\n> +\ttest_cmp_bin expect actual\n> +'\n> +\n>   test_expect_success 'values returned in order requested' '\n>   \tcat >expect <<-\\EOF &&\n>   \tlayout.bare=false\n\nThe patch itself looks fine. The 'git repo info' command seems to be a \nrelatively new one, so I think adding a test script is necessary...\n\n...except one thing to mention:\n\n > +test_expect_success 'setup linked worktree' '\n > +\tgit init main &&\n > +\tgit -C main worktree add ../linked\n\nSince the main repo here is an empty, can a linked worktree be created? \nHere, HEAD does not point to a valid object, and there is no commit \navailable checkout. I think it would be better to create a commit using \ntest_commit first.\n\nRegards,\n\nYuchen\n\n\n"}]}