{"thread":{"id":"64811","subject":"[PATCH] subtree: validate --prefix against commit in split","startedAt":"2026-01-15T12:10:18Z","lastAt":"2026-02-05T20:54:21Z","messageCount":19,"participants":["Pushkar Singh","Junio C Hamano","Josh Steadmon","Jeff King","Colin Stagner"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"533946","messageId":"20260115120936.18491-1-pushkarkumarsingh1970@gmail.com","threadId":"64811","inReplyTo":null,"subject":"[PATCH] subtree: validate --prefix against commit in split","fromName":"Pushkar Singh","fromEmail":"pushkarkumarsingh1970@gmail.com","sentAt":"2026-01-15T12:09:36Z","receivedAt":"2026-01-15T12:10:18Z","isPatch":true,"sender":{"key":"pushkarkumarsingh1970@gmail.com","avatar":"https://avatars.githubusercontent.com/u/173247767?v=4"},"body":"---\n contrib/subtree/git-subtree.sh | 17 +++++++++++++----\n 1 file changed, 13 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 17106d1a72..a1b60eac8b 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -257,6 +257,9 @@ main () {\n \t\ttest -e \"$arg_prefix\" &&\n \t\t\tdie \"fatal: prefix '$arg_prefix' already exists.\"\n \t\t;;\n+\tsplit)\n+        # checked later against the commit, not the working tree\n+        ;;\n \t*)\n \t\ttest -e \"$arg_prefix\" ||\n \t\t\tdie \"fatal: '$arg_prefix' does not exist; use 'git subtree add'\"\n@@ -958,13 +961,19 @@ cmd_add_commit () {\n cmd_split () {\n \tif test $# -eq 0\n \tthen\n-\t\trev=$(git rev-parse HEAD)\n+\t\t\trev=$(git rev-parse HEAD)\n \telif test $# -eq 1 || test $# -eq 2\n \tthen\n-\t\trev=$(git rev-parse -q --verify \"$1^{commit}\") ||\n-\t\t\tdie \"fatal: '$1' does not refer to a commit\"\n+\t\t\trev=$(git rev-parse -q --verify \"$1^{commit}\") ||\n+\t\t\t\t\tdie \"fatal: '$1' does not refer to a commit\"\n \telse\n-\t\tdie \"fatal: you must provide exactly one revision, and optionally a repository.  Got: '$*'\"\n+\t\t\tdie \"fatal: you must provide exactly one revision, and optionally a repository.  Got: '$*'\"\n+\tfi\n+\n+\t# Now validate prefix against the commit, not the working tree\n+\tif ! git ls-tree -d \"$rev\" -- \"$dir\" >/dev/null\n+\tthen\n+\t\t\tdie \"fatal: '$dir' does not exist in commit $rev\"\n \tfi\n \trepository=\"\"\n \tif test \"$#\" = 2\n-- \n2.43.0\n\n"},{"id":"533947","messageId":"20260115122652.18673-2-pushkarkumarsingh1970@gmail.com","threadId":"64811","inReplyTo":"20260115120936.18491-1-pushkarkumarsingh1970@gmail.com","subject":"[PATCH v2] subtree: validate --prefix against commit in split","fromName":"Pushkar Singh","fromEmail":"pushkarkumarsingh1970@gmail.com","sentAt":"2026-01-15T12:24:35Z","receivedAt":"2026-01-15T12:28:08Z","isPatch":true,"sender":{"key":"pushkarkumarsingh1970@gmail.com","avatar":"https://avatars.githubusercontent.com/u/173247767?v=4"},"body":"git subtree split currently validates --prefix against the working tree.\nThis breaks when splitting an older commit or when the working tree does\nnot contain the subtree, even though the commit does.\n\nFor example:\n\n  git subtree split --prefix=pkg <commit>\n\nfails if pkg was removed later, even though it exists in <commit>.\n\nFix this by validating the prefix against the specified commit using\ngit ls-tree instead of the working tree.\n\nSigned-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>\n---\n contrib/subtree/git-subtree.sh | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 17106d1a72..a5822b66d5 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -257,6 +257,9 @@ main () {\n \t\ttest -e \"$arg_prefix\" &&\n \t\t\tdie \"fatal: prefix '$arg_prefix' already exists.\"\n \t\t;;\n+\tsplit)\n+        # checked later against the commit, not the working tree\n+        ;;\n \t*)\n \t\ttest -e \"$arg_prefix\" ||\n \t\t\tdie \"fatal: '$arg_prefix' does not exist; use 'git subtree add'\"\n@@ -966,6 +969,12 @@ cmd_split () {\n \telse\n \t\tdie \"fatal: you must provide exactly one revision, and optionally a repository.  Got: '$*'\"\n \tfi\n+\n+\t# Now validate prefix against the commit, not the working tree\n+\tif ! git ls-tree -d \"$rev\" -- \"$dir\" >/dev/null\n+\tthen\n+\t\tdie \"fatal: '$dir' does not exist in commit $rev\"\n+\tfi\n \trepository=\"\"\n \tif test \"$#\" = 2\n \tthen\n-- \n2.43.0\n\n"},{"id":"533969","messageId":"xmqqh5smdejc.fsf@gitster.g","threadId":"64811","inReplyTo":"20260115122652.18673-2-pushkarkumarsingh1970@gmail.com","subject":"Re: [PATCH v2] subtree: validate --prefix against commit in split","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-01-15T16:30:31Z","receivedAt":"2026-01-15T16:30:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pushkar Singh <pushkarkumarsingh1970@gmail.com> writes:\n\n> git subtree split currently validates --prefix against the working tree.\n> This breaks when splitting an older commit or when the working tree does\n> not contain the subtree, even though the commit does.\n>\n> For example:\n>\n>   git subtree split --prefix=pkg <commit>\n>\n> fails if pkg was removed later, even though it exists in <commit>.\n>\n> Fix this by validating the prefix against the specified commit using\n> git ls-tree instead of the working tree.\n>\n> Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>\n> ---\n>  contrib/subtree/git-subtree.sh | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n\nIs this something you can protect from future breakage with a test,\nperhaps in contrib/subtree/t/t7900-subtree.sh?\n\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index 17106d1a72..a5822b66d5 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -257,6 +257,9 @@ main () {\n>  \t\ttest -e \"$arg_prefix\" &&\n>  \t\t\tdie \"fatal: prefix '$arg_prefix' already exists.\"\n>  \t\t;;\n> +\tsplit)\n> +        # checked later against the commit, not the working tree\n> +        ;;\n\nFunny indentation?\n"},{"id":"533977","messageId":"20260115175403.3971-3-pushkarkumarsingh1970@gmail.com","threadId":"64811","inReplyTo":"xmqqh5smdejc.fsf@gitster.g","subject":"[PATCH v3] subtree: validate --prefix against commit in split","fromName":"Pushkar Singh","fromEmail":"pushkarkumarsingh1970@gmail.com","sentAt":"2026-01-15T17:52:26Z","receivedAt":"2026-01-15T17:56:41Z","isPatch":true,"sender":{"key":"pushkarkumarsingh1970@gmail.com","avatar":"https://avatars.githubusercontent.com/u/173247767?v=4"},"body":"git subtree split currently validates --prefix against the working tree.\nThis breaks when splitting an older commit or when the working tree does\nnot contain the subtree, even though the commit does.\n\nFor example:\n\n  git subtree split --prefix=pkg <commit>\n\nfails if pkg was removed later, even though it exists in <commit>.\n\nFix this by validating the prefix against the specified commit using\ngit ls-tree instead of the working tree.\n\nAdd a test to ensure this behavior does not regress.\n\nSigned-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>\n---\n contrib/subtree/git-subtree.sh     |  9 +++++++++\n contrib/subtree/t/t7900-subtree.sh | 22 ++++++++++++++++++++++\n 2 files changed, 31 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 17106d1a72..324ed38148 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -257,6 +257,9 @@ main () {\n \t\ttest -e \"$arg_prefix\" &&\n \t\t\tdie \"fatal: prefix '$arg_prefix' already exists.\"\n \t\t;;\n+\tsplit)\n+\t\t# checked later against the commit, not the working tree\n+\t\t;;\n \t*)\n \t\ttest -e \"$arg_prefix\" ||\n \t\t\tdie \"fatal: '$arg_prefix' does not exist; use 'git subtree add'\"\n@@ -966,6 +969,12 @@ cmd_split () {\n \telse\n \t\tdie \"fatal: you must provide exactly one revision, and optionally a repository.  Got: '$*'\"\n \tfi\n+\n+\t# Now validate prefix against the commit, not the working tree\n+\tif ! git ls-tree -d \"$rev\" -- \"$dir\" >/dev/null\n+\tthen\n+\t\tdie \"fatal: '$dir' does not exist in commit $rev\"\n+\tfi\n \trepository=\"\"\n \tif test \"$#\" = 2\n \tthen\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 316dc5269e..e4f632f3af 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -368,6 +368,28 @@ test_expect_success 'split requires path given by option --prefix must exist' '\n \t)\n '\n \n+test_expect_success 'split works when prefix exists in commit but not in working tree' '\n+\tsubtree_test_create_repo \"$test_count\" &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\n+\t\t# create subtree\n+\t\tmkdir pkg &&\n+\t\techo ok >pkg/file &&\n+\t\tgit add pkg &&\n+\t\tgit commit -m \"add pkg\" &&\n+\t\tgood=$(git rev-parse HEAD) &&\n+\n+\t\t# remove it from working tree in later commit\n+\t\tgit rm -r pkg &&\n+\t\tgit commit -m \"remove pkg\" &&\n+\n+\t\t# must still be able to split using the old commit\n+\t\tgit subtree split --prefix=pkg \"$good\" >out &&\n+\t\ttest -s out\n+\t)\n+'\n+\n test_expect_success 'split rejects flags for add' '\n \tsubtree_test_create_repo \"$test_count\" &&\n \tsubtree_test_create_repo \"$test_count/sub proj\" &&\n-- \n2.43.0\n\n"},{"id":"534997","messageId":"7k7ewvrb5hj3jyesiigy6dvo5w5pl67rk7ihztsuxbtqpymafv@ey64nvhzhacg","threadId":"64811","inReplyTo":"20260115175403.3971-3-pushkarkumarsingh1970@gmail.com","subject":"Re: [PATCH v3] subtree: validate --prefix against commit in split","fromName":"Josh Steadmon","fromEmail":"steadmon@google.com","sentAt":"2026-02-02T18:54:13Z","receivedAt":"2026-02-02T18:54:20Z","isPatch":true,"sender":{"key":"steadmon@google.com","avatar":"https://avatars.githubusercontent.com/u/2654920?v=4"},"body":"On 2026.01.15 17:52, Pushkar Singh wrote:\n> git subtree split currently validates --prefix against the working tree.\n> This breaks when splitting an older commit or when the working tree does\n> not contain the subtree, even though the commit does.\n> \n> For example:\n> \n>   git subtree split --prefix=pkg <commit>\n> \n> fails if pkg was removed later, even though it exists in <commit>.\n> \n> Fix this by validating the prefix against the specified commit using\n> git ls-tree instead of the working tree.\n> \n> Add a test to ensure this behavior does not regress.\n> \n> Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>\n\nUnfortunately, it seems this patch breaks the subtree tests. We noticed\na failure in our build system at $WORK, and I was able to bisect the\nfailure to this commit:\n\n$ git bisect start 54b18a3513eed9ed5ced5c238ade55a434fd619a 66b2238f5c17644ddf15f75a53c76faeca6d9f1e\n$ git bisect run sh -c 'make && make -C contrib/subtree && make -C contrib/subtree test'\n\nThe tests fail on case 17 - split requires path given by option --prefix\nmust exist.\n"},{"id":"535002","messageId":"xmqqwm0vx8pi.fsf@gitster.g","threadId":"64811","inReplyTo":"7k7ewvrb5hj3jyesiigy6dvo5w5pl67rk7ihztsuxbtqpymafv@ey64nvhzhacg","subject":"Re: [PATCH v3] subtree: validate --prefix against commit in split","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-02T19:10:33Z","receivedAt":"2026-02-02T19:10:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Josh Steadmon <steadmon@google.com> writes:\n\n> Unfortunately, it seems this patch breaks the subtree tests. We noticed\n> a failure in our build system at $WORK, and I was able to bisect the\n> failure to this commit:\n>\n> $ git bisect start 54b18a3513eed9ed5ced5c238ade55a434fd619a 66b2238f5c17644ddf15f75a53c76faeca6d9f1e\n> $ git bisect run sh -c 'make && make -C contrib/subtree && make -C contrib/subtree test'\n>\n> The tests fail on case 17 - split requires path given by option --prefix\n> must exist.\n\nThanks for a quick regression report while it is still in 'next', so\nthat we can revert it out of 'next' without breaking the 'master'.\n"},{"id":"535013","messageId":"xmqqjywuyhu9.fsf@gitster.g","threadId":"64811","inReplyTo":"7k7ewvrb5hj3jyesiigy6dvo5w5pl67rk7ihztsuxbtqpymafv@ey64nvhzhacg","subject":"Re: [PATCH v3] subtree: validate --prefix against commit in split","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-02T21:07:58Z","receivedAt":"2026-02-02T21:08:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Josh Steadmon <steadmon@google.com> writes:\n\n> On 2026.01.15 17:52, Pushkar Singh wrote:\n>> git subtree split currently validates --prefix against the working tree.\n>> This breaks when splitting an older commit or when the working tree does\n>> not contain the subtree, even though the commit does.\n>> \n>> For example:\n>> \n>>   git subtree split --prefix=pkg <commit>\n>> \n>> fails if pkg was removed later, even though it exists in <commit>.\n>> \n>> Fix this by validating the prefix against the specified commit using\n>> git ls-tree instead of the working tree.\n>> \n>> Add a test to ensure this behavior does not regress.\n>> \n>> Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>\n>\n> Unfortunately, it seems this patch breaks the subtree tests. We noticed\n> a failure in our build system at $WORK, and I was able to bisect the\n> failure to this commit:\n>\n> $ git bisect start 54b18a3513eed9ed5ced5c238ade55a434fd619a 66b2238f5c17644ddf15f75a53c76faeca6d9f1e\n> $ git bisect run sh -c 'make && make -C contrib/subtree && make -C contrib/subtree test'\n>\n> The tests fail on case 17 - split requires path given by option --prefix\n> must exist.\n\nThanks.  I am tempted to propose us doing something like this, so\nthat you guys do not have to every time you import my 'next'.\n\n--- >8 ---\nSubject: [PATCH] test: optionally test contrib in CI\n\nRecently it was reported that a topic merged to 'next' broke build\nand test for contrib/subtree part of the system.\n\nInstead of having those who run 'next' or 'master' to hit the build\nand test breakage and report to us, make sure we notice breakages in\ncontrib/ area before they hit my tree at all, during their own\npresubmit testing.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n * There should be a cleaner way to make sure any new Makefile with\n   \"test\" target in contrib/* directores are added to the execution,\n   but for now this should do.\n\n Makefile                  |  6 ++++++\n ci/run-build-and-tests.sh |  2 ++\n contrib/Makefile          | 10 ++++++++++\n 3 files changed, 18 insertions(+)\n create mode 100644 contrib/Makefile\n\ndiff --git a/Makefile b/Makefile\nindex 8aa489f3b6..d0ab8fdb04 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -342,6 +342,9 @@ include shared.mak\n # If it isn't set, fallback to $LC_ALL, $LANG or use the first utf-8\n # locale returned by \"locale -a\".\n #\n+# Define TEST_CONTRIB_TOO to make \"make test\" run tests in contrib/\n+# directories.\n+#\n # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.\n #\n # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.\n@@ -3369,6 +3372,9 @@ export TEST_NO_MALLOC_CHECK\n \n test: all\n \t$(MAKE) -C t/ all\n+ifdef TEST_CONTRIB_TOO\n+\t$(MAKE) -C contrib/ test\n+endif\n \n perf: all\n \t$(MAKE) -C t/perf/ all\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 8bda62b921..b07b89f954 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -5,6 +5,8 @@\n \n . ${0%/*}/lib.sh\n \n+export TEST_CONTRIB_TOO=yes\n+\n case \"$jobname\" in\n fedora-breaking-changes-musl|linux-breaking-changes)\n \texport WITH_BREAKING_CHANGES=YesPlease\ndiff --git a/contrib/Makefile b/contrib/Makefile\nnew file mode 100644\nindex 0000000000..787cd07f52\n--- /dev/null\n+++ b/contrib/Makefile\n@@ -0,0 +1,10 @@\n+all::\n+\n+test::\n+\t$(MAKE) -C diff-highlight $@\n+\t$(MAKE) -C subtree $@\n+\n+clean::\n+\t$(MAKE) -C contacts $@\n+\t$(MAKE) -C diff-highlight $@\n+\t$(MAKE) -C subtree $@\n-- \n2.53.0-154-gaa371a4585\n\n"},{"id":"535065","messageId":"xmqqsebhu9nn.fsf_-_@gitster.g","threadId":"64811","inReplyTo":"xmqqjywuyhu9.fsf@gitster.g","subject":"[RFH] adding test coverage for contrib/ in CI jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-03T15:30:36Z","receivedAt":"2026-02-03T15:30:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Thanks.  I am tempted to propose us doing something like this, so\n> that you guys do not have to every time you import my 'next'.\n>\n> --- >8 ---\n> Subject: [PATCH] test: optionally test contrib in CI\n>\n> Recently it was reported that a topic merged to 'next' broke build\n> and test for contrib/subtree part of the system.\n>\n> Instead of having those who run 'next' or 'master' to hit the build\n> and test breakage and report to us, make sure we notice breakages in\n> contrib/ area before they hit my tree at all, during their own\n> presubmit testing.\n>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>\n>  * There should be a cleaner way to make sure any new Makefile with\n>    \"test\" target in contrib/* directores are added to the execution,\n>    but for now this should do.\n\nUnfortunately, this seems to reveal existing other problems with\nsubtree tests (t7900), in addition to diff-highlight tests (t9400)\nin various configurations.\n\n  https://github.com/git/git/actions/runs/21617099884\n\nThis Ci run is near the tip of 'seen', so there may be breakages\nattributable to new topics in flight, but I suspect that many of\nthem are already in 'master', noticed by nobody because nobody ran\nthese tests in these configurations (like \"breaking changes\",\n\"sha256\", \"leaks\", \"reftable\", \"asan\").\n\nI didn't look into the details of any of these (yet).\n\n\n\n>  Makefile                  |  6 ++++++\n>  ci/run-build-and-tests.sh |  2 ++\n>  contrib/Makefile          | 10 ++++++++++\n>  3 files changed, 18 insertions(+)\n>  create mode 100644 contrib/Makefile\n>\n> diff --git a/Makefile b/Makefile\n> index 8aa489f3b6..d0ab8fdb04 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -342,6 +342,9 @@ include shared.mak\n>  # If it isn't set, fallback to $LC_ALL, $LANG or use the first utf-8\n>  # locale returned by \"locale -a\".\n>  #\n> +# Define TEST_CONTRIB_TOO to make \"make test\" run tests in contrib/\n> +# directories.\n> +#\n>  # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.\n>  #\n>  # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.\n> @@ -3369,6 +3372,9 @@ export TEST_NO_MALLOC_CHECK\n>  \n>  test: all\n>  \t$(MAKE) -C t/ all\n> +ifdef TEST_CONTRIB_TOO\n> +\t$(MAKE) -C contrib/ test\n> +endif\n>  \n>  perf: all\n>  \t$(MAKE) -C t/perf/ all\n> diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\n> index 8bda62b921..b07b89f954 100755\n> --- a/ci/run-build-and-tests.sh\n> +++ b/ci/run-build-and-tests.sh\n> @@ -5,6 +5,8 @@\n>  \n>  . ${0%/*}/lib.sh\n>  \n> +export TEST_CONTRIB_TOO=yes\n> +\n>  case \"$jobname\" in\n>  fedora-breaking-changes-musl|linux-breaking-changes)\n>  \texport WITH_BREAKING_CHANGES=YesPlease\n> diff --git a/contrib/Makefile b/contrib/Makefile\n> new file mode 100644\n> index 0000000000..787cd07f52\n> --- /dev/null\n> +++ b/contrib/Makefile\n> @@ -0,0 +1,10 @@\n> +all::\n> +\n> +test::\n> +\t$(MAKE) -C diff-highlight $@\n> +\t$(MAKE) -C subtree $@\n> +\n> +clean::\n> +\t$(MAKE) -C contacts $@\n> +\t$(MAKE) -C diff-highlight $@\n> +\t$(MAKE) -C subtree $@\n"},{"id":"535072","messageId":"20260203164815.68258-2-pushkarkumarsingh1970@gmail.com","threadId":"64811","inReplyTo":"20260115175403.3971-3-pushkarkumarsingh1970@gmail.com","subject":"[PATCH v4] subtree: validate --prefix against commit in split","fromName":"Pushkar Singh","fromEmail":"pushkarkumarsingh1970@gmail.com","sentAt":"2026-02-03T16:48:16Z","receivedAt":"2026-02-03T16:59:41Z","isPatch":true,"sender":{"key":"pushkarkumarsingh1970@gmail.com","avatar":"https://avatars.githubusercontent.com/u/173247767?v=4"},"body":"git subtree split currently validates --prefix against the working tree.\nThis breaks when splitting an older commit or when the working tree does\nnot contain the subtree, even though the commit does.\n\nFor example:\n\n  git subtree split --prefix=pkg <commit>\n\nfails if pkg was removed later, even though it exists in <commit>.\n\nFix this by validating the prefix against the specified commit using\ngit cat-file instead of the working tree.\n\nAdd a test to ensure this behavior does not regress.\n\nSigned-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>\n---\n\nChanges since v3:\n- Fix regression in existing subtree tests by checking prefix existence\n  with git cat-file instead of git ls-tree -d\n- Preserve original error message to keep test 17 passing\n\n contrib/subtree/git-subtree.sh     |  9 +++++++++\n contrib/subtree/t/t7900-subtree.sh | 22 ++++++++++++++++++++++\n 2 files changed, 31 insertions(+)\n\ndiff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\nindex 17106d1a72..d7f9121f2f 100755\n--- a/contrib/subtree/git-subtree.sh\n+++ b/contrib/subtree/git-subtree.sh\n@@ -257,6 +257,9 @@ main () {\n \t\ttest -e \"$arg_prefix\" &&\n \t\t\tdie \"fatal: prefix '$arg_prefix' already exists.\"\n \t\t;;\n+\tsplit)\n+\t\t# checked later against the commit, not the working tree\n+\t\t;;\n \t*)\n \t\ttest -e \"$arg_prefix\" ||\n \t\t\tdie \"fatal: '$arg_prefix' does not exist; use 'git subtree add'\"\n@@ -966,6 +969,12 @@ cmd_split () {\n \telse\n \t\tdie \"fatal: you must provide exactly one revision, and optionally a repository.  Got: '$*'\"\n \tfi\n+\n+\t# Now validate prefix against the commit, not the working tree\n+\tif ! git cat-file -e \"$rev:$dir\" 2>/dev/null\n+\tthen\n+\t\tdie \"fatal: '$dir' does not exist; use 'git subtree add'\"\n+\tfi\n \trepository=\"\"\n \tif test \"$#\" = 2\n \tthen\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 316dc5269e..e4f632f3af 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -368,6 +368,28 @@ test_expect_success 'split requires path given by option --prefix must exist' '\n \t)\n '\n \n+test_expect_success 'split works when prefix exists in commit but not in working tree' '\n+\tsubtree_test_create_repo \"$test_count\" &&\n+\t(\n+\t\tcd \"$test_count\" &&\n+\n+\t\t# create subtree\n+\t\tmkdir pkg &&\n+\t\techo ok >pkg/file &&\n+\t\tgit add pkg &&\n+\t\tgit commit -m \"add pkg\" &&\n+\t\tgood=$(git rev-parse HEAD) &&\n+\n+\t\t# remove it from working tree in later commit\n+\t\tgit rm -r pkg &&\n+\t\tgit commit -m \"remove pkg\" &&\n+\n+\t\t# must still be able to split using the old commit\n+\t\tgit subtree split --prefix=pkg \"$good\" >out &&\n+\t\ttest -s out\n+\t)\n+'\n+\n test_expect_success 'split rejects flags for add' '\n \tsubtree_test_create_repo \"$test_count\" &&\n \tsubtree_test_create_repo \"$test_count/sub proj\" &&\n-- \n2.43.0\n\n"},{"id":"535078","messageId":"xmqqjywtu58j.fsf_-_@gitster.g","threadId":"64811","inReplyTo":"xmqqsebhu9nn.fsf_-_@gitster.g","subject":"Re* [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-03T17:06:04Z","receivedAt":"2026-02-03T17:06:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Unfortunately, this seems to reveal existing other problems with\n> subtree tests (t7900), in addition to diff-highlight tests (t9400)\n> in various configurations.\n>\n>   https://github.com/git/git/actions/runs/21617099884\n>\n> This Ci run is near the tip of 'seen', so there may be breakages\n> attributable to new topics in flight, but I suspect that many of\n> them are already in 'master', noticed by nobody because nobody ran\n> these tests in these configurations (like \"breaking changes\",\n> \"sha256\", \"leaks\", \"reftable\", \"asan\").\n>\n> I didn't look into the details of any of these (yet).\n\nI didn't look into CI failures but spotted an easy one by\neyeballing.  As we seem to be lacking a dedicated subsystem\nmaintainer for this tool, I am CCing those who have touched this\ntest file during the past 24 months, plus our resident reftable\nexpert.\n\n----- >8 -----\nSubject: subtree: allow testing with reftable backend\n\n\"git subtree\" (in contrib/) comes with its own test script, which\nhas this line\n\n    defaultBranch=$(sed \"s,ref: refs/heads/,,\" \"$test_count/.git/HEAD\")\n\nthat assumes that you can read from .git/HEAD as a regular text file\nand you'd find a textual symref in reffiles backend.\n\nNot necessarily.\n\n    make && cd contrib/subtree && \n    GIT_TEST_DEFAULT_REF_FORMAT=reftable make test\n\nfails due to this.  Use \"git symbolic-ref\" instead to read the value\nof the symref.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n contrib/subtree/t/t7900-subtree.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git c/contrib/subtree/t/t7900-subtree.sh w/contrib/subtree/t/t7900-subtree.sh\nindex 316dc5269e..344956e72e 100755\n--- c/contrib/subtree/t/t7900-subtree.sh\n+++ w/contrib/subtree/t/t7900-subtree.sh\n@@ -1597,7 +1597,8 @@ test_expect_success 'push split to subproj' '\n \n test_expect_success 'subtree descendant check' '\n \tsubtree_test_create_repo \"$test_count\" &&\n-\tdefaultBranch=$(sed \"s,ref: refs/heads/,,\" \"$test_count/.git/HEAD\") &&\n+\n+\tdefaultBranch=$(git -C \"$test_count\" symbolic-ref --short HEAD) &&\n \ttest_create_commit \"$test_count\" folder_subtree/a &&\n \t(\n \t\tcd \"$test_count\" &&\n"},{"id":"535079","messageId":"xmqqecn1u3rx.fsf@gitster.g","threadId":"64811","inReplyTo":"20260203164815.68258-2-pushkarkumarsingh1970@gmail.com","subject":"Re: [PATCH v4] subtree: validate --prefix against commit in split","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-03T17:37:38Z","receivedAt":"2026-02-03T17:37:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Pushkar Singh <pushkarkumarsingh1970@gmail.com> writes:\n\n> Changes since v3:\n> - Fix regression in existing subtree tests by checking prefix existence\n>   with git cat-file instead of git ls-tree -d\n\nOK, the check used to run\n\n    git ls-tree -d \"$rev\" -- \"$dir\"\n\nwhich (if I am reading this correctly) succeeded only when \"$dir\" is\nan existing directory in \"$rev\".  Now you use\n\n    git cat-file -e \"$rev:$dir\" 2>/dev/null\n\nand this allows \"$dir\" to be a non-directory but say a blob.\n\n> - Preserve original error message to keep test 17 passing\n\nAhh, OK.  I didn't check how the test was failing.  This message is\nmade to look like the error message we used to get much earlier\nbefore calling cmd_split, and now cmd_split detects the condition to\ngive the error message, so it is better to match it.  Makes sense.\n\n>  contrib/subtree/git-subtree.sh     |  9 +++++++++\n>  contrib/subtree/t/t7900-subtree.sh | 22 ++++++++++++++++++++++\n>  2 files changed, 31 insertions(+)\n>\n> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh\n> index 17106d1a72..d7f9121f2f 100755\n> --- a/contrib/subtree/git-subtree.sh\n> +++ b/contrib/subtree/git-subtree.sh\n> @@ -257,6 +257,9 @@ main () {\n>  \t\ttest -e \"$arg_prefix\" &&\n>  \t\t\tdie \"fatal: prefix '$arg_prefix' already exists.\"\n>  \t\t;;\n> +\tsplit)\n> +\t\t# checked later against the commit, not the working tree\n> +\t\t;;\n>  \t*)\n>  \t\ttest -e \"$arg_prefix\" ||\n>  \t\t\tdie \"fatal: '$arg_prefix' does not exist; use 'git subtree add'\"\n> @@ -966,6 +969,12 @@ cmd_split () {\n>  \telse\n>  \t\tdie \"fatal: you must provide exactly one revision, and optionally a repository.  Got: '$*'\"\n>  \tfi\n> +\n> +\t# Now validate prefix against the commit, not the working tree\n> +\tif ! git cat-file -e \"$rev:$dir\" 2>/dev/null\n> +\tthen\n> +\t\tdie \"fatal: '$dir' does not exist; use 'git subtree add'\"\n> +\tfi\n>  \trepository=\"\"\n>  \tif test \"$#\" = 2\n>  \tthen\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index 316dc5269e..e4f632f3af 100755\n> --- a/contrib/subtree/t/t7900-subtree.sh\n> +++ b/contrib/subtree/t/t7900-subtree.sh\n> @@ -368,6 +368,28 @@ test_expect_success 'split requires path given by option --prefix must exist' '\n>  \t)\n>  '\n>  \n> +test_expect_success 'split works when prefix exists in commit but not in working tree' '\n> +\tsubtree_test_create_repo \"$test_count\" &&\n> +\t(\n> +\t\tcd \"$test_count\" &&\n> +\n> +\t\t# create subtree\n> +\t\tmkdir pkg &&\n> +\t\techo ok >pkg/file &&\n> +\t\tgit add pkg &&\n> +\t\tgit commit -m \"add pkg\" &&\n> +\t\tgood=$(git rev-parse HEAD) &&\n> +\n> +\t\t# remove it from working tree in later commit\n> +\t\tgit rm -r pkg &&\n> +\t\tgit commit -m \"remove pkg\" &&\n> +\n> +\t\t# must still be able to split using the old commit\n> +\t\tgit subtree split --prefix=pkg \"$good\" >out &&\n> +\t\ttest -s out\n> +\t)\n> +'\n> +\n>  test_expect_success 'split rejects flags for add' '\n>  \tsubtree_test_create_repo \"$test_count\" &&\n>  \tsubtree_test_create_repo \"$test_count/sub proj\" &&\n"},{"id":"535092","messageId":"xmqq7bstsemv.fsf@gitster.g","threadId":"64811","inReplyTo":"xmqqsebhu9nn.fsf_-_@gitster.g","subject":"Re: [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-03T21:26:00Z","receivedAt":"2026-02-03T21:26:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> ...\n> Unfortunately, this seems to reveal existing other problems with\n> subtree tests (t7900), in addition to diff-highlight tests (t9400)\n> in various configurations.\n>\n>   https://github.com/git/git/actions/runs/21617099884\n>\n> This CI run is near the tip of 'seen', so there may be breakages\n> attributable to new topics in flight, but I suspect that many of\n> them are already in 'master', noticed by nobody because nobody ran\n> these tests in these configurations (like \"breaking changes\",\n> \"sha256\", \"leaks\", \"reftable\", \"asan\").\n\nTest that comes with diff-highlight fails WITH_BREAKING_CHANGES CI\njob, which has multiple ways to work around.  The easiest one is to\nforce the branch name that is documented in the comment part of the\ntest file that illustrates the topology of the history, which is\nwhat I picked.\n\n----- >8 -----\nSubject: diff-highlight: allow testing with Git 3.0 breaking changes\n\nThe diff-highlight (in contrib/) comes with its own test script,\nwhich relies on the initial branch name being 'master'.  This is not\njust encoded in the test logic, but in the illustration in the file\nthat shows the topology of the history.\n\nForce the initial branch name to 'master' to allow it pass.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n contrib/diff-highlight/t/t9400-diff-highlight.sh | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git c/contrib/diff-highlight/t/t9400-diff-highlight.sh w/contrib/diff-highlight/t/t9400-diff-highlight.sh\nindex f6f5195d00..dee296739c 100755\n--- c/contrib/diff-highlight/t/t9400-diff-highlight.sh\n+++ w/contrib/diff-highlight/t/t9400-diff-highlight.sh\n@@ -10,6 +10,8 @@ DIFF_HIGHLIGHT=\"$CURR_DIR\"/../diff-highlight\n CW=\"$(printf \"\\033[7m\")\"\t# white\n CR=\"$(printf \"\\033[27m\")\"\t# reset\n \n+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\n . \"$TEST_DIRECTORY\"/test-lib.sh\n \n if ! test_have_prereq PERL\n"},{"id":"535098","messageId":"20260203215347.GA340210@coredump.intra.peff.net","threadId":"64811","inReplyTo":"xmqq7bstsemv.fsf@gitster.g","subject":"Re: [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2026-02-03T21:53:47Z","receivedAt":"2026-02-03T21:53:56Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 03, 2026 at 01:26:00PM -0800, Junio C Hamano wrote:\n\n> ----- >8 -----\n> Subject: diff-highlight: allow testing with Git 3.0 breaking changes\n> \n> The diff-highlight (in contrib/) comes with its own test script,\n> which relies on the initial branch name being 'master'.  This is not\n> just encoded in the test logic, but in the illustration in the file\n> that shows the topology of the history.\n> \n> Force the initial branch name to 'master' to allow it pass.\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\nThanks, I think this is a fine solution. In such cases it is sometimes\nnice to remove the dependence on the branch name entirely. But it looks\nlike it would be a pain to do so in this case, and not worth the time.\n\nMost of the other instances of GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME set\nit to \"main\". I guess one day in the future, post v3.0, we might drop\nall of those and decide that \"main\" is here to stay. In which case we\nmight also want to drop these outliers and just switch them to \"main\",\ntoo. But I am content to punt that off to another day.\n\n-Peff\n\nPS As you might have guessed, I have not run these tests in ages. I'd\n   only do so when actually changing something in diff-highlight, and\n   that hasn't happened in a while. In fact, I rarely run it at all\n   these days; I usually use the third-party \"delta\" program in its\n   \"--color-only\" mode, as it does a better job of true intra-line\n   tokenization and diffing.\n\n   I don't know what that means for diff-highlight. I'm happy to\n   continue to review patches for it, and I think it mostly Just Works\n   and doesn't need active maintenance. But I'm also OK if we dropped\n   it.\n"},{"id":"535110","messageId":"xmqqa4xpqv94.fsf@gitster.g","threadId":"64811","inReplyTo":"xmqqjywtu58j.fsf_-_@gitster.g","subject":"Re: Re* [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-03T23:09:59Z","receivedAt":"2026-02-03T23:10:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Unfortunately, this seems to reveal existing other problems with\n>> subtree tests (t7900), in addition to diff-highlight tests (t9400)\n>> in various configurations.\n>>\n>>   https://github.com/git/git/actions/runs/21617099884\n>>\n>> This Ci run is near the tip of 'seen', so there may be breakages\n>> attributable to new topics in flight, but I suspect that many of\n>> them are already in 'master', noticed by nobody because nobody ran\n>> these tests in these configurations (like \"breaking changes\",\n>> \"sha256\", \"leaks\", \"reftable\", \"asan\").\n>>\n>> I didn't look into the details of any of these (yet).\n>\n> I didn't look into CI failures but spotted an easy one by\n> eyeballing.  As we seem to be lacking a dedicated subsystem\n> maintainer for this tool, I am CCing those who have touched this\n> test file during the past 24 months, plus our resident reftable\n> expert.\n\nThe subtree tests seems to be badly broken, so for now I've enabled\nthe contrib tests at CI to only linux-TEST-vars job (which seems to\nbe passing) and *-breaking-changes jobs.\n\nHelp by those who are more familiar with subtree is very much\nappreciated.  Start by looking at failures in\n\n    https://github.com/git/git/actions/runs/21649279837/job/62409376111\n\nThanks.\n"},{"id":"535115","messageId":"20260204043812.814884-3-ask+git@howdoi.land","threadId":"64811","inReplyTo":"xmqqjywtu58j.fsf_-_@gitster.g","subject":"Re* [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Colin Stagner","fromEmail":"ask+git@howdoi.land","sentAt":"2026-02-04T04:38:11Z","receivedAt":"2026-02-04T04:41:27Z","isPatch":false,"sender":{"key":"ask+git@howdoi.land","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I didn't look into CI failures but spotted an easy one by\n> eyeballing.\n\n[snip]\n\n>--- c/contrib/subtree/t/t7900-subtree.sh\n>+++ w/contrib/subtree/t/t7900-subtree.sh\n>@@ -1597,7 +1597,8 @@ test_expect_success 'push split to subproj' '\n> \n> test_expect_success 'subtree descendant check' '\n> \tsubtree_test_create_repo \"$test_count\" &&\n>-\tdefaultBranch=$(sed \"s,ref: refs/heads/,,\" \"$test_count/.git/HEAD\") &&\n>+\n>+\tdefaultBranch=$(git -C \"$test_count\" symbolic-ref --short HEAD) &&\n\nThe subtree tests set GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME, so\nthis is one alternative.\n\nI'll see what I can do about any remaining failures. I'd like to\nimprove the test coverage for subtree split. split has a lot of\ncomplicated logic that needs to be preserved across updates.\n\n-- >8 --\n\nSubject: contrib/subtree: fix tests with reftable backend\n\nOne git-subtree test-case relies on git internals to infer the\ndefault branch name. This test fails with the new reftable\nbackend.\n\n    GIT_TEST_DEFAULT_REF_FORMAT=reftable \\\n      meson test t7900-subtree\n\nThis test script already sets\n\n    GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n\nwhich eliminates the need to infer a branch name at runtime.\nHardcode the branch name.\n\nSigned-off-by: Colin Stagner <ask+git@howdoi.land>\n---\n contrib/subtree/t/t7900-subtree.sh | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\nindex 316dc5269e..e7040718f2 100755\n--- a/contrib/subtree/t/t7900-subtree.sh\n+++ b/contrib/subtree/t/t7900-subtree.sh\n@@ -1597,7 +1597,6 @@ test_expect_success 'push split to subproj' '\n \n test_expect_success 'subtree descendant check' '\n \tsubtree_test_create_repo \"$test_count\" &&\n-\tdefaultBranch=$(sed \"s,ref: refs/heads/,,\" \"$test_count/.git/HEAD\") &&\n \ttest_create_commit \"$test_count\" folder_subtree/a &&\n \t(\n \t\tcd \"$test_count\" &&\n@@ -1614,7 +1613,7 @@ test_expect_success 'subtree descendant check' '\n \t(\n \t\tcd \"$test_count\" &&\n \t\tgit cherry-pick $cherry &&\n-\t\tgit checkout $defaultBranch &&\n+\t\tgit checkout main &&\n \t\tgit merge -m \"merge should be kept on subtree\" branch &&\n \t\tgit branch no_subtree_work_branch\n \t) &&\n@@ -1626,10 +1625,10 @@ test_expect_success 'subtree descendant check' '\n \ttest_create_commit \"$test_count\" not_a_subtree_change &&\n \t(\n \t\tcd \"$test_count\" &&\n-\t\tgit checkout $defaultBranch &&\n+\t\tgit checkout main &&\n \t\tgit merge -m \"merge should be skipped on subtree\" no_subtree_work_branch &&\n \n-\t\tgit subtree split --prefix folder_subtree/ --branch subtree_tip $defaultBranch &&\n+\t\tgit subtree split --prefix folder_subtree/ --branch subtree_tip main &&\n \t\tgit subtree split --prefix folder_subtree/ --branch subtree_branch branch &&\n \t\ttest $(git rev-list --count subtree_tip..subtree_branch) = 0\n \t)\n-- \n2.43.0\n\n"},{"id":"535189","messageId":"xmqqms1onv16.fsf@gitster.g","threadId":"64811","inReplyTo":"20260204043812.814884-3-ask+git@howdoi.land","subject":"Re: Re* [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-04T19:55:17Z","receivedAt":"2026-02-04T19:55:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Colin Stagner <ask+git@howdoi.land> writes:\n\n> I'll see what I can do about any remaining failures. I'd like to\n> improve the test coverage for subtree split. split has a lot of\n> complicated logic that needs to be preserved across updates.\n\nThanks.\n\n\n> Subject: contrib/subtree: fix tests with reftable backend\n>\n> One git-subtree test-case relies on git internals to infer the\n> default branch name. This test fails with the new reftable\n> backend.\n>\n>     GIT_TEST_DEFAULT_REF_FORMAT=reftable \\\n>       meson test t7900-subtree\n>\n> This test script already sets\n>\n>     GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n>\n> which eliminates the need to infer a branch name at runtime.\n> Hardcode the branch name.\n\nMakes sense.  \n\nI didn't read the test script carefully enough to be certain that we\nwere on the initial branch when the defaultBranch computation\nhappened.\n\nThanks.  Will replace my hack with this version.\n\n> Signed-off-by: Colin Stagner <ask+git@howdoi.land>\n> ---\n>  contrib/subtree/t/t7900-subtree.sh | 7 +++----\n>  1 file changed, 3 insertions(+), 4 deletions(-)\n>\n> diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh\n> index 316dc5269e..e7040718f2 100755\n> --- a/contrib/subtree/t/t7900-subtree.sh\n> +++ b/contrib/subtree/t/t7900-subtree.sh\n> @@ -1597,7 +1597,6 @@ test_expect_success 'push split to subproj' '\n>  \n>  test_expect_success 'subtree descendant check' '\n>  \tsubtree_test_create_repo \"$test_count\" &&\n> -\tdefaultBranch=$(sed \"s,ref: refs/heads/,,\" \"$test_count/.git/HEAD\") &&\n>  \ttest_create_commit \"$test_count\" folder_subtree/a &&\n>  \t(\n>  \t\tcd \"$test_count\" &&\n> @@ -1614,7 +1613,7 @@ test_expect_success 'subtree descendant check' '\n>  \t(\n>  \t\tcd \"$test_count\" &&\n>  \t\tgit cherry-pick $cherry &&\n> -\t\tgit checkout $defaultBranch &&\n> +\t\tgit checkout main &&\n>  \t\tgit merge -m \"merge should be kept on subtree\" branch &&\n>  \t\tgit branch no_subtree_work_branch\n>  \t) &&\n> @@ -1626,10 +1625,10 @@ test_expect_success 'subtree descendant check' '\n>  \ttest_create_commit \"$test_count\" not_a_subtree_change &&\n>  \t(\n>  \t\tcd \"$test_count\" &&\n> -\t\tgit checkout $defaultBranch &&\n> +\t\tgit checkout main &&\n>  \t\tgit merge -m \"merge should be skipped on subtree\" no_subtree_work_branch &&\n>  \n> -\t\tgit subtree split --prefix folder_subtree/ --branch subtree_tip $defaultBranch &&\n> +\t\tgit subtree split --prefix folder_subtree/ --branch subtree_tip main &&\n>  \t\tgit subtree split --prefix folder_subtree/ --branch subtree_branch branch &&\n>  \t\ttest $(git rev-list --count subtree_tip..subtree_branch) = 0\n>  \t)\n"},{"id":"535208","messageId":"ef128e1d-dd3e-4573-bfcd-6a98a0a1f394@howdoi.land","threadId":"64811","inReplyTo":"xmqqjywtu58j.fsf_-_@gitster.g","subject":"Re: Re* [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Colin Stagner","fromEmail":"ask+git@howdoi.land","sentAt":"2026-02-05T06:05:59Z","receivedAt":"2026-02-05T06:06:14Z","isPatch":false,"sender":{"key":"ask+git@howdoi.land","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Unfortunately, this seems to reveal existing other problems with\n> subtree tests (t7900), in addition to diff-highlight tests (t9400)\n> in various configurations.\n> \n> https://github.com/git/git/actions/runs/21617099884\n> \n> This Ci run is near the tip of 'seen', so there may be breakages\n> attributable to new topics in flight\n\nAt least some of the subtree failures on linux-reftable, such as\n\n<https://github.com/git/git/actions/runs/21617099884/job/62298228602#step:10:421>\n\nare actually due to a bug in ubuntu:rolling's \"dirname\" implementation. \nThis was fixed upstream in late January [1].\n\nbug behavior demo:\n\n     podman run --rm -it -q docker.io/library/ubuntu:questing-20251217 \\\n       dirname whatever/.\n\noutputs \"whatever\"\n\n     podman run --rm -it -q docker.io/library/ubuntu:25.10 \\\n       dirname whatever/.\n\noutputs \".\"\n\n\nsubtree has an up-front call to\n\n     dir=\"$(dirname \"$arg_prefix/.\")\"\n\nwhich encounters the defect. It then attempts to do things like\n\n     git read-tree --prefix=. $someref\n\nthat error out with messages like \"error: invalid path './sub1'\"\n\n\n[1]: https://github.com/uutils/coreutils/issues/10508\n\n"},{"id":"535258","messageId":"xmqqikcbm9ew.fsf@gitster.g","threadId":"64811","inReplyTo":"ef128e1d-dd3e-4573-bfcd-6a98a0a1f394@howdoi.land","subject":"Re: Re* [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-05T16:39:51Z","receivedAt":"2026-02-05T16:39:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Colin Stagner <ask+git@howdoi.land> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Unfortunately, this seems to reveal existing other problems with\n>> subtree tests (t7900), in addition to diff-highlight tests (t9400)\n>> in various configurations.\n>> \n>> https://github.com/git/git/actions/runs/21617099884\n>> \n>> This Ci run is near the tip of 'seen', so there may be breakages\n>> attributable to new topics in flight\n>\n> At least some of the subtree failures on linux-reftable, such as\n>\n> <https://github.com/git/git/actions/runs/21617099884/job/62298228602#step:10:421>\n>\n> are actually due to a bug in ubuntu:rolling's \"dirname\" implementation. \n\nAhh, rust bites again?\n\nIs there /etc/alternatives/dirname like /etc/alternatives/sudo that\nwe used in fddb4842 (ci: fix broken jobs on Ubuntu 25.10 caused by\nswitch to sudo-rs(1), 2025-10-10) to work a breakage around, I have\nto wonder...\n\n"},{"id":"535281","messageId":"xmqq4inulxms.fsf@gitster.g","threadId":"64811","inReplyTo":"xmqqikcbm9ew.fsf@gitster.g","subject":"Re: Re* [RFH] adding test coverage for contrib/ in CI jobs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-02-05T20:54:19Z","receivedAt":"2026-02-05T20:54:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Colin Stagner <ask+git@howdoi.land> writes:\n> ...\n>> At least some of the subtree failures on linux-reftable, such as\n>>\n>> <https://github.com/git/git/actions/runs/21617099884/job/62298228602#step:10:421>\n>>\n>> are actually due to a bug in ubuntu:rolling's \"dirname\" implementation. \n>\n> Ahh, rust bites again?\n>\n> Is there /etc/alternatives/dirname like /etc/alternatives/sudo that\n> we used in fddb4842 (ci: fix broken jobs on Ubuntu 25.10 caused by\n> switch to sudo-rs(1), 2025-10-10) to work a breakage around, I have\n> to wonder...\n\nSo I tried a custom CI run that has\n\n * a temporary patch that demotes ubuntu:rolling to ubuntu:latest in\n   GitHub workflows\n\n * your subtree test fix to use the hardcoded 'main'\n\n * a similar fix for diff-highlight test <xmqq7bstsemv.fsf@gitster.g>\n\n * a change to run \"make test\" in contrib/* directories <xmqqjywuyhu9.fsf@gitster.g>\n\non top of 'master'.  Everything seems to be happy.      \n\nhttps://github.com/git/git/actions/runs/21726017981\n\n"}]}