git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] subtree: validate --prefix against commit in split

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 2, 2026, 21:07 UTC
Message-ID
<xmqqjywuyhu9.fsf@gitster.g>
In-Reply-To
<7k7ewvrb5hj3jyesiigy6dvo5w5pl67rk7ihztsuxbtqpymafv@ey64nvhzhacg>
Josh Steadmon <steadmon@google.com> writes:
Show 27 quoted lines
> On 2026.01.15 17:52, Pushkar Singh wrote:
>> git subtree split currently validates --prefix against the working tree.
>> This breaks when splitting an older commit or when the working tree does
>> not contain the subtree, even though the commit does.
>> 
>> For example:
>> 
>>   git subtree split --prefix=pkg <commit>
>> 
>> fails if pkg was removed later, even though it exists in <commit>.
>> 
>> Fix this by validating the prefix against the specified commit using
>> git ls-tree instead of the working tree.
>> 
>> Add a test to ensure this behavior does not regress.
>> 
>> Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
>
> Unfortunately, it seems this patch breaks the subtree tests. We noticed
> a failure in our build system at $WORK, and I was able to bisect the
> failure to this commit:
>
> $ git bisect start 54b18a3513eed9ed5ced5c238ade55a434fd619a 66b2238f5c17644ddf15f75a53c76faeca6d9f1e
> $ git bisect run sh -c 'make && make -C contrib/subtree && make -C contrib/subtree test'
>
> The tests fail on case 17 - split requires path given by option --prefix
> must exist.

Thanks. I am tempted to propose us doing something like this, so that you guys do not have to every time you import my 'next'.

--- >8 ---
Subject: [PATCH] test: optionally test contrib in CI

Recently it was reported that a topic merged to 'next' broke build and test for contrib/subtree part of the system.

Instead of having those who run 'next' or 'master' to hit the build and test breakage and report to us, make sure we notice breakages in contrib/ area before they hit my tree at all, during their own presubmit testing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * There should be a cleaner way to make sure any new Makefile with
   "test" target in contrib/* directores are added to the execution,
   but for now this should do.
 Makefile                  |  6 ++++++
 ci/run-build-and-tests.sh |  2 ++
 contrib/Makefile          | 10 ++++++++++
 3 files changed, 18 insertions(+)
 create mode 100644 contrib/Makefile
diff --git a/Makefile b/Makefile
index 8aa489f3b6..d0ab8fdb04 100644
--- a/Makefile
+++ b/Makefile
@@ -342,6 +342,9 @@ include shared.mak
 # If it isn't set, fallback to $LC_ALL, $LANG or use the first utf-8
 # locale returned by "locale -a".
 #
+# Define TEST_CONTRIB_TOO to make "make test" run tests in contrib/
+# directories.
+#
 # Define HAVE_CLOCK_GETTIME if your platform has clock_gettime.
 #
 # Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC.
@@ -3369,6 +3372,9 @@ export TEST_NO_MALLOC_CHECK
 
 test: all
 	$(MAKE) -C t/ all
+ifdef TEST_CONTRIB_TOO
+	$(MAKE) -C contrib/ test
+endif
 
 perf: all
 	$(MAKE) -C t/perf/ all
diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh
index 8bda62b921..b07b89f954 100755
--- a/ci/run-build-and-tests.sh
+++ b/ci/run-build-and-tests.sh
@@ -5,6 +5,8 @@
 
 . ${0%/*}/lib.sh
 
+export TEST_CONTRIB_TOO=yes
+
 case "$jobname" in
 fedora-breaking-changes-musl|linux-breaking-changes)
 	export WITH_BREAKING_CHANGES=YesPlease
diff --git a/contrib/Makefile b/contrib/Makefile
new file mode 100644
index 0000000000..787cd07f52
--- /dev/null
+++ b/contrib/Makefile
@@ -0,0 +1,10 @@
+all::
+
+test::
+	$(MAKE) -C diff-highlight $@
+	$(MAKE) -C subtree $@
+
+clean::
+	$(MAKE) -C contacts $@
+	$(MAKE) -C diff-highlight $@
+	$(MAKE) -C subtree $@
-- 
2.53.0-154-gaa371a4585
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 19 in “subtree: validate --prefix against commit in split”
  1. subtree: validate --prefix against commit in splitPushkar Singh, Jan 15, 2026
  2. subtree: validate --prefix against commit in splitPushkar Singh, Jan 15, 2026
  3. Junio C HamanoJan 15, 2026
  4. subtree: validate --prefix against commit in splitPushkar Singh, Jan 15, 2026
  5. Josh SteadmonFeb 2, 2026
  6. Junio C HamanoFeb 2, 2026
  7. Junio C HamanoFeb 2, 2026
  8. [RFH] adding test coverage for contrib/ in CI jobsJunio C Hamano, Feb 3, 2026
  9. Re* [RFH] adding test coverage for contrib/ in CI jobsJunio C Hamano, Feb 3, 2026
  10. Junio C HamanoFeb 3, 2026
  11. Re* [RFH] adding test coverage for contrib/ in CI jobsColin Stagner, Feb 4, 2026
  12. Junio C HamanoFeb 4, 2026
  13. Colin StagnerFeb 5, 2026
  14. Junio C HamanoFeb 5, 2026
  15. Junio C HamanoFeb 5, 2026
  16. Junio C HamanoFeb 3, 2026
  17. Jeff KingFeb 3, 2026
  18. subtree: validate --prefix against commit in splitPushkar Singh, Feb 3, 2026
  19. Junio C HamanoFeb 3, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.