{"thread":{"id":"65057","subject":"[PATCH git] t5516: test updateInstead with worktree and unborn bare HEAD","startedAt":"2026-02-23T14:21:45Z","lastAt":"2026-03-31T22:21:16Z","messageCount":11,"participants":["Runxi Yu","Junio C Hamano","Pablo Sabater","Pablo"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"536809","messageId":"20260223141236.22476-1-me@runxiyu.org","threadId":"65057","inReplyTo":null,"subject":"[PATCH git] t5516: test updateInstead with worktree and unborn bare HEAD","fromName":"Runxi Yu","fromEmail":"me@runxiyu.org","sentAt":"2026-02-23T14:12:20Z","receivedAt":"2026-02-23T14:21:45Z","isPatch":true,"body":"This is a regression test which should presently fail, to demonstrate\nthe behavior I encountered that looks like a bug.\n\nWhen a bare repository has a worktree checked out on a separate branch,\nreceive.denyCurrentBranch=updateInstead should allow a push to that\nbranch and update the linked worktree, as long as the linked worktree is\nclean.\n\nBut, if the bare repository's own HEAD is repointed to an unborn branch,\nthe push is rejected with \"Working directory has staged changes\", even\nthough the linked worktree itself is clean.\n\nThis test is essentially a minimal working example of what I encountered\nwhile actually using Git; it might not be the optimal way to demonstrate\nthe underlying bug. I suspect builtin/receive-pack.c is using the bare\nrepository's HEAD even when comparing it to the worktree's index.\n\nSigned-off-by: Runxi Yu <me@runxiyu.org>\n---\n t/t5516-fetch-push.sh | 18 ++++++++++++++++++\n 1 file changed, 18 insertions(+)\n\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex 29e2f17608..f44250c38f 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -1816,6 +1816,24 @@ test_expect_success 'denyCurrentBranch and bare repository worktrees' '\n \ttest_must_fail git push --delete bare.git wt\n '\n \n+# NEEDSWORK: updateInstead unexpectedly fails when bare HEAD points to unborn\n+# branch (or probably any ref that differs from the target worktree) despite\n+# the target worktree being clean. This seems to be because receive-pack.c\n+# diffs the target worktree index against the bare repository HEAD.\n+test_expect_failure 'updateInstead with bare repository worktree and unborn bare HEAD' '\n+\ttest_when_finished \"rm -fr bare.git cloned\" &&\n+\tgit clone --bare . bare.git &&\n+\tgit -C bare.git worktree add wt &&\n+\tgit -C bare.git config receive.denyCurrentBranch updateInstead &&\n+\tgit -C bare.git symbolic-ref HEAD refs/heads/unborn &&\n+\ttest_must_fail git -C bare.git rev-parse -q --verify HEAD^{commit} &&\n+\tgit clone . cloned &&\n+\ttest_commit -C cloned mozzarella &&\n+\tgit -C cloned push ../bare.git HEAD:wt &&\n+\ttest_path_exists bare.git/wt/mozzarella.t &&\n+\ttest \"$(git -C cloned rev-parse HEAD)\" = \"$(git -C bare.git/wt rev-parse HEAD)\"\n+'\n+\n test_expect_success 'refuse fetch to current branch of worktree' '\n \ttest_when_finished \"git worktree remove --force wt && git branch -D wt\" &&\n \tgit worktree add wt &&\n-- \n2.53.0\n\n"},{"id":"536868","messageId":"xmqq1pibnuej.fsf@gitster.g","threadId":"65057","inReplyTo":"20260223141236.22476-1-me@runxiyu.org","subject":"Re: [PATCH git] t5516: test updateInstead with worktree and unborn bare HEAD","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-23T19:15:32Z","receivedAt":"2026-02-23T19:15:34Z","isPatch":true,"body":"Runxi Yu <me@runxiyu.org> writes:\n\n> This is a regression test which should presently fail, to demonstrate\n> the behavior I encountered that looks like a bug.\n\nDid it ever worked before?  When did it regress?\n"},{"id":"536910","messageId":"DGMWTSG72GEI.1TA0INKB1UHB6@runxiyu.org","threadId":"65057","inReplyTo":"xmqq1pibnuej.fsf@gitster.g","subject":"Re: [PATCH git] t5516: test updateInstead with worktree and unborn bare HEAD","fromName":"Runxi Yu","fromEmail":"me@runxiyu.org","sentAt":"2026-02-24T04:33:34Z","receivedAt":"2026-02-24T04:33:38Z","isPatch":true,"body":"On Tue Feb 24, 2026 at 3:15 AM CST, Junio C Hamano wrote:\n> Did it ever worked before?  When did it regress?\n\nNot that I know of. Unfortunately it's a bit difficult to build older\nversions, but the same logic was present in this commit and in main:\n\n> commit 9fdf4f1db422cc259e4a3ce0023a255102c6fa3b\n> Author: Anders Kaseorg <andersk@MIT.EDU>\n> Date:   Wed Dec 1 14:15:46 2021 -0800\n> \n>     receive-pack: protect current branch for bare repository worktree\n>     \n>     A bare repository won’t have a working tree at \"..\", but it may still\n>     have separate working trees created with git worktree. We should protect\n>     the current branch of such working trees from being updated or deleted,\n>     according to receive.denyCurrentBranch.\n>     \n>     Signed-off-by: Anders Kaseorg <andersk@mit.edu>\n>     Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nupdate finds the destination linked worktree correctly\nupdate_worktree sets GIT_DIR\npush_to_deploy decides whether to diff against HEAD or the empty tree by calling head_has_history\nbut head_has_history uses the bare repo's HEAD rather than the destination worktree\n\nhead_has_history used get_oid before vs repo_get_oid now, but they still\nboth seem to use the bare repo instead of the worktree's HEAD.\n\nSo if the bare repo's own HEAD is unborn, in both current main and\n9fdf4f1db42, we would be incorrectly choosing the empty tree for the\n'has staged changes' check's base, and report failure, even though the\nlinked worktree is clean\n\n\n\nWell, by regression test, I don't mean that this was a previous\nregression; I just mean that, this was a way to reproduce this bug that\nsounds reasonable and could serve as a future regression test.\n"},{"id":"537654","messageId":"DGT28LI984JN.2J085E2142YHO@runxiyu.org","threadId":"65057","inReplyTo":"DGMWTSG72GEI.1TA0INKB1UHB6@runxiyu.org","subject":"Re: [PATCH git] t5516: test updateInstead with worktree and unborn bare HEAD","fromName":"Runxi Yu","fromEmail":"me@runxiyu.org","sentAt":"2026-03-03T10:03:59Z","receivedAt":"2026-03-03T10:04:08Z","isPatch":true,"body":"I'd appreciate considering this thread again since it's been a bit more\nthan a week.\n\nThank you!!\n"},{"id":"540362","messageId":"20260330111822.165188-1-pabloosabaterr@gmail.com","threadId":"65057","inReplyTo":"20260223141236.22476-1-me@runxiyu.org","subject":"[GSoC PATCH 0/3] receive-pack: fix HEAD check for updateInstead","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-03-30T11:18:19Z","receivedAt":"2026-03-30T11:18:31Z","isPatch":true,"body":"When a bare repo has linked worktrees, and its HEAD points to an unborn branch,\npushing to a wt branch with updateInstead fails and rejects the push, even if\nthe wt is clean.\n\nThis happens because HEAD is checked only for the bare repo context, instead\nof the wt.\n\nThis series includes Runxi's test, a cleanup of a test that messes with Runxi's\ntest and the fix for the issue.\n\nPablo Sabater (2):\n  t5516: clean up cloned and new-wt in denyCurrentBranch and worktrees\n    test\n  receive-pack: use worktree HEAD for updateInstead\n\nRunxi Yu (1):\n  t5516: test updateInstead with worktree and unborn bare HEAD\n\n builtin/receive-pack.c | 39 +++++++++++++++------------------------\n t/t5516-fetch-push.sh  | 15 +++++++++++++++\n 2 files changed, 30 insertions(+), 24 deletions(-)\n\n\nbase-commit: ca1db8a0f7dc0dbea892e99f5b37c5fe5861be71\n-- \n2.43.0\n\n"},{"id":"540363","messageId":"20260330111822.165188-2-pabloosabaterr@gmail.com","threadId":"65057","inReplyTo":"20260330111822.165188-1-pabloosabaterr@gmail.com","subject":"[GSoC PATCH 1/3] t5516: test updateInstead with worktree and unborn bare HEAD","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-03-30T11:18:20Z","receivedAt":"2026-03-30T11:18:33Z","isPatch":true,"body":"From: Runxi Yu <me@runxiyu.org>\n\nThis is a regression test which should presently fail, to demonstrate\nthe behavior I encountered that looks like a bug.\n\nWhen a bare repository has a worktree checked out on a separate branch,\nreceive.denyCurrentBranch=updateInstead should allow a push to that\nbranch and update the linked worktree, as long as the linked worktree is\nclean.\n\nBut, if the bare repository's own HEAD is repointed to an unborn branch,\nthe push is rejected with \"Working directory has staged changes\", even\nthough the linked worktree itself is clean.\n\nThis test is essentially a minimal working example of what I encountered\nwhile actually using Git; it might not be the optimal way to demonstrate\nthe underlying bug. I suspect builtin/receive-pack.c is using the bare\nrepository's HEAD even when comparing it to the worktree's index.\n\nSigned-off-by: Runxi Yu <me@runxiyu.org>\n---\n t/t5516-fetch-push.sh | 18 ++++++++++++++++++\n 1 file changed, 18 insertions(+)\n\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex 29e2f17608..f44250c38f 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -1816,6 +1816,24 @@ test_expect_success 'denyCurrentBranch and bare repository worktrees' '\n \ttest_must_fail git push --delete bare.git wt\n '\n \n+# NEEDSWORK: updateInstead unexpectedly fails when bare HEAD points to unborn\n+# branch (or probably any ref that differs from the target worktree) despite\n+# the target worktree being clean. This seems to be because receive-pack.c\n+# diffs the target worktree index against the bare repository HEAD.\n+test_expect_failure 'updateInstead with bare repository worktree and unborn bare HEAD' '\n+\ttest_when_finished \"rm -fr bare.git cloned\" &&\n+\tgit clone --bare . bare.git &&\n+\tgit -C bare.git worktree add wt &&\n+\tgit -C bare.git config receive.denyCurrentBranch updateInstead &&\n+\tgit -C bare.git symbolic-ref HEAD refs/heads/unborn &&\n+\ttest_must_fail git -C bare.git rev-parse -q --verify HEAD^{commit} &&\n+\tgit clone . cloned &&\n+\ttest_commit -C cloned mozzarella &&\n+\tgit -C cloned push ../bare.git HEAD:wt &&\n+\ttest_path_exists bare.git/wt/mozzarella.t &&\n+\ttest \"$(git -C cloned rev-parse HEAD)\" = \"$(git -C bare.git/wt rev-parse HEAD)\"\n+'\n+\n test_expect_success 'refuse fetch to current branch of worktree' '\n \ttest_when_finished \"git worktree remove --force wt && git branch -D wt\" &&\n \tgit worktree add wt &&\n-- \n2.43.0\n\n"},{"id":"540364","messageId":"20260330111822.165188-3-pabloosabaterr@gmail.com","threadId":"65057","inReplyTo":"20260330111822.165188-1-pabloosabaterr@gmail.com","subject":"[GSoC PATCH 2/3] t5516: clean up cloned and new-wt in denyCurrentBranch and worktrees test","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-03-30T11:18:21Z","receivedAt":"2026-03-30T11:18:35Z","isPatch":true,"body":"The 'denyCurrentBranch and worktrees' test creates a 'cloned' and a 'new-wt'\nbut it doesn't clean them after the test. This makes other tests that use\nthe same name after this one to fail.\n\nAdd test_when_finished to clean them at the end.\n\nSigned-off-by: Pablo Sabater <pabloosabaterr@gmail.com>\n---\n t/t5516-fetch-push.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex f44250c38f..c40f2790d8 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -1792,6 +1792,7 @@ test_expect_success 'updateInstead with push-to-checkout hook' '\n '\n \n test_expect_success 'denyCurrentBranch and worktrees' '\n+\ttest_when_finished \"rm -fr cloned && git worktree remove --force new-wt\" &&\n \tgit worktree add new-wt &&\n \tgit clone . cloned &&\n \ttest_commit -C cloned first &&\n-- \n2.43.0\n\n"},{"id":"540365","messageId":"20260330111822.165188-4-pabloosabaterr@gmail.com","threadId":"65057","inReplyTo":"20260330111822.165188-1-pabloosabaterr@gmail.com","subject":"[GSoC PATCH 3/3] receive-pack: use worktree HEAD for updateInstead","fromName":"Pablo Sabater","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-03-30T11:18:22Z","receivedAt":"2026-03-30T11:18:39Z","isPatch":true,"body":"When a bare repo has linked worktrees, and its HEAD points to an unborn branch,\npushing to a wt branch with updateInstead fails and rejects the push, even if\nthe wt is clean. This happens because HEAD is checked only for the bare repo\ncontext, instead of the wt.\n\nRemove head_has_history and check for worktree->head_oid which does\nhave the correct HEAD of the wt.\n\nUpdate the test added by Runxi's patch to expect success.\n\nSigned-off-by: Pablo Sabater <pabloosabaterr@gmail.com>\n---\n builtin/receive-pack.c | 39 +++++++++++++++------------------------\n t/t5516-fetch-push.sh  |  6 +-----\n 2 files changed, 16 insertions(+), 29 deletions(-)\n\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex d6225df890..2a0fb13250 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1380,32 +1380,16 @@ static int update_shallow_ref(struct command *cmd, struct shallow_info *si)\n \treturn 0;\n }\n \n-/*\n- * NEEDSWORK: we should consolidate various implementations of \"are we\n- * on an unborn branch?\" test into one, and make the unified one more\n- * robust. !get_sha1() based check used here and elsewhere would not\n- * allow us to tell an unborn branch from corrupt ref, for example.\n- * For the purpose of fixing \"deploy-to-update does not work when\n- * pushing into an empty repository\" issue, this should suffice for\n- * now.\n- */\n-static int head_has_history(void)\n-{\n-\tstruct object_id oid;\n-\n-\treturn !repo_get_oid(the_repository, \"HEAD\", &oid);\n-}\n-\n static const char *push_to_deploy(unsigned char *sha1,\n \t\t\t\t  struct strvec *env,\n-\t\t\t\t  const char *work_tree)\n+\t\t\t\t  const struct worktree *worktree)\n {\n \tstruct child_process child = CHILD_PROCESS_INIT;\n \n \tstrvec_pushl(&child.args, \"update-index\", \"-q\", \"--ignore-submodules\",\n \t\t     \"--refresh\", NULL);\n \tstrvec_pushv(&child.env, env->v);\n-\tchild.dir = work_tree;\n+\tchild.dir = worktree->path;\n \tchild.no_stdin = 1;\n \tchild.stdout_to_stderr = 1;\n \tchild.git_cmd = 1;\n@@ -1417,7 +1401,7 @@ static const char *push_to_deploy(unsigned char *sha1,\n \tstrvec_pushl(&child.args, \"diff-files\", \"--quiet\",\n \t\t     \"--ignore-submodules\", \"--\", NULL);\n \tstrvec_pushv(&child.env, env->v);\n-\tchild.dir = work_tree;\n+\tchild.dir = worktree->path;\n \tchild.no_stdin = 1;\n \tchild.stdout_to_stderr = 1;\n \tchild.git_cmd = 1;\n@@ -1427,9 +1411,16 @@ static const char *push_to_deploy(unsigned char *sha1,\n \tchild_process_init(&child);\n \tstrvec_pushl(&child.args, \"diff-index\", \"--quiet\", \"--cached\",\n \t\t     \"--ignore-submodules\",\n-\t\t     /* diff-index with either HEAD or an empty tree */\n-\t\t     head_has_history() ? \"HEAD\" : empty_tree_oid_hex(the_repository->hash_algo),\n-\t\t     \"--\", NULL);\n+\t\t     /*\n+\t\t      * diff-index with either HEAD or an empty tree\n+\t\t      *\n+\t\t      * NEEDSWORK: is_null_oid() cannot know whether it's an\n+\t\t      * unborn HEAD or a corrupt ref. It works for now because\n+\t\t      * it's only needed to know if we are comparing HEAD or an\n+\t\t      * empty tree.\n+\t\t      */\n+\t\t     !is_null_oid(&worktree->head_oid) ? \"HEAD\" :\n+\t\t     empty_tree_oid_hex(the_repository->hash_algo), \"--\", NULL);\n \tstrvec_pushv(&child.env, env->v);\n \tchild.no_stdin = 1;\n \tchild.no_stdout = 1;\n@@ -1442,7 +1433,7 @@ static const char *push_to_deploy(unsigned char *sha1,\n \tstrvec_pushl(&child.args, \"read-tree\", \"-u\", \"-m\", hash_to_hex(sha1),\n \t\t     NULL);\n \tstrvec_pushv(&child.env, env->v);\n-\tchild.dir = work_tree;\n+\tchild.dir = worktree->path;\n \tchild.no_stdin = 1;\n \tchild.no_stdout = 1;\n \tchild.stdout_to_stderr = 0;\n@@ -1490,7 +1481,7 @@ static const char *update_worktree(unsigned char *sha1, const struct worktree *w\n \n \tretval = push_to_checkout(sha1, &invoked_hook, &env, worktree->path);\n \tif (!invoked_hook)\n-\t\tretval = push_to_deploy(sha1, &env, worktree->path);\n+\t\tretval = push_to_deploy(sha1, &env, worktree);\n \n \tstrvec_clear(&env);\n \tfree(git_dir);\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex c40f2790d8..117cfa051f 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -1817,11 +1817,7 @@ test_expect_success 'denyCurrentBranch and bare repository worktrees' '\n \ttest_must_fail git push --delete bare.git wt\n '\n \n-# NEEDSWORK: updateInstead unexpectedly fails when bare HEAD points to unborn\n-# branch (or probably any ref that differs from the target worktree) despite\n-# the target worktree being clean. This seems to be because receive-pack.c\n-# diffs the target worktree index against the bare repository HEAD.\n-test_expect_failure 'updateInstead with bare repository worktree and unborn bare HEAD' '\n+test_expect_success 'updateInstead with bare repository worktree and unborn bare HEAD' '\n \ttest_when_finished \"rm -fr bare.git cloned\" &&\n \tgit clone --bare . bare.git &&\n \tgit -C bare.git worktree add wt &&\n-- \n2.43.0\n\n"},{"id":"540394","messageId":"xmqqy0j9e3t9.fsf@gitster.g","threadId":"65057","inReplyTo":"20260330111822.165188-1-pabloosabaterr@gmail.com","subject":"Re: [GSoC PATCH 0/3] receive-pack: fix HEAD check for updateInstead","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-30T15:26:42Z","receivedAt":"2026-03-30T15:26:45Z","isPatch":true,"body":"Pablo Sabater <pabloosabaterr@gmail.com> writes:\n\n> When a bare repo has linked worktrees, and its HEAD points to an unborn branch,\n> pushing to a wt branch with updateInstead fails and rejects the push, even if\n> the wt is clean.\n>\n> This happens because HEAD is checked only for the bare repo context, instead\n> of the wt.\n>\n> This series includes Runxi's test, a cleanup of a test that messes with Runxi's\n> test and the fix for the issue.\n\nIt would have made a perfect cover letter if you said in a very\nearly paragraph what Runxi is and how it related to this issue.  I\nam guessing (from the fact that the same word appears in the patch\nlist below with family name) that is a name of a person who first\nreported the issue?  If so, the missing sentence would have said\nsomething like \"At https/lore.kernel.org/git/$MessageId, Runxi Yu\nreported ...\".\n\nI have to leave the keyboard now, so will take a look at the patches\nlater today.  Thanks.\n\n\n> Pablo Sabater (2):\n>   t5516: clean up cloned and new-wt in denyCurrentBranch and worktrees\n>     test\n>   receive-pack: use worktree HEAD for updateInstead\n>\n> Runxi Yu (1):\n>   t5516: test updateInstead with worktree and unborn bare HEAD\n>\n>  builtin/receive-pack.c | 39 +++++++++++++++------------------------\n>  t/t5516-fetch-push.sh  | 15 +++++++++++++++\n>  2 files changed, 30 insertions(+), 24 deletions(-)\n>\n>\n> base-commit: ca1db8a0f7dc0dbea892e99f5b37c5fe5861be71\n"},{"id":"540419","messageId":"CAN5EUNRYpzbT58jAaheBVNG_jxVFJy5a=r_v7gREPyspQ8zTyw@mail.gmail.com","threadId":"65057","inReplyTo":"xmqqy0j9e3t9.fsf@gitster.g","subject":"Re: [GSoC PATCH 0/3] receive-pack: fix HEAD check for updateInstead","fromName":"Pablo","fromEmail":"pabloosabaterr@gmail.com","sentAt":"2026-03-30T18:49:45Z","receivedAt":"2026-03-30T18:50:01Z","isPatch":true,"body":"Junio C Hamano (<gitster@pobox.com>) writes:\n>\n> Pablo Sabater <pabloosabaterr@gmail.com> writes:\n>\n> > When a bare repo has linked worktrees, and its HEAD points to an unborn branch,\n> > pushing to a wt branch with updateInstead fails and rejects the push, even if\n> > the wt is clean.\n> >\n> > This happens because HEAD is checked only for the bare repo context, instead\n> > of the wt.\n> >\n> > This series includes Runxi's test, a cleanup of a test that messes with Runxi's\n> > test and the fix for the issue.\n>\n> It would have made a perfect cover letter if you said in a very\n> early paragraph what Runxi is and how it related to this issue.  I\n> am guessing (from the fact that the same word appears in the patch\n> list below with family name) that is a name of a person who first\n> reported the issue?  If so, the missing sentence would have said\n> something like \"At https/lore.kernel.org/git/$MessageId, Runxi Yu\n> reported ...\".\n>\n\nI thought that by sending the series in-reply to the original Runxi's\nreport it wouldn't be needed. But yeah, it isn't clear if someone would\nonly read the cover letter.\n\nthis is Runxi's original report which is the parent of this thread:\n\n  https://lore.kernel.org/git/20260223141236.22476-1-me@runxiyu.org/\n\nThanks for the feedback :)\n\n> I have to leave the keyboard now, so will take a look at the patches\n> later today.  Thanks.\n>\n>\n> > Pablo Sabater (2):\n> >   t5516: clean up cloned and new-wt in denyCurrentBranch and worktrees\n> >     test\n> >   receive-pack: use worktree HEAD for updateInstead\n> >\n> > Runxi Yu (1):\n> >   t5516: test updateInstead with worktree and unborn bare HEAD\n> >\n> >  builtin/receive-pack.c | 39 +++++++++++++++------------------------\n> >  t/t5516-fetch-push.sh  | 15 +++++++++++++++\n> >  2 files changed, 30 insertions(+), 24 deletions(-)\n> >\n> >\n> > base-commit: ca1db8a0f7dc0dbea892e99f5b37c5fe5861be71\n"},{"id":"540575","messageId":"xmqqldf7wsh1.fsf@gitster.g","threadId":"65057","inReplyTo":"20260330111822.165188-1-pabloosabaterr@gmail.com","subject":"Re: [GSoC PATCH 0/3] receive-pack: fix HEAD check for updateInstead","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-31T22:21:14Z","receivedAt":"2026-03-31T22:21:16Z","isPatch":true,"body":"Pablo Sabater <pabloosabaterr@gmail.com> writes:\n\n> This series includes Runxi's test, a cleanup of a test that messes with Runxi's\n> test and the fix for the issue.\n>\n> Pablo Sabater (2):\n>   t5516: clean up cloned and new-wt in denyCurrentBranch and worktrees\n>     test\n>   receive-pack: use worktree HEAD for updateInstead\n\nI re-read the main patch [3/3]; we used to check \"HEAD\" in\nthe_repository but now we pass the worktree object (not just its\n\"path\" member) down the callchain, and that allows us to check if\nthe worktree's HEAD is unborn.  Which makes sense and is a\nsurprisingly small fix.\n\nLet me mark the topic for 'next'.  Thanks.\n\n\n\n\n>\n> Runxi Yu (1):\n>   t5516: test updateInstead with worktree and unborn bare HEAD\n>\n>  builtin/receive-pack.c | 39 +++++++++++++++------------------------\n>  t/t5516-fetch-push.sh  | 15 +++++++++++++++\n>  2 files changed, 30 insertions(+), 24 deletions(-)\n>\n>\n> base-commit: ca1db8a0f7dc0dbea892e99f5b37c5fe5861be71\n"}]}