git/contrib/subtree
Colin Stagner 83f9dad7d6 contrib/subtree: fix split with squashed subtrees
98ba49ccc2 (subtree: fix split processing with multiple subtrees
present, 2023-12-01) increases the performance of

    git subtree split --prefix=subA

by ignoring subtree merges which are outside of `subA/`. It also
introduces a regression. Subtree merges that should be retained
are incorrectly ignored if they:

1. are nested under `subA/`; and
2. are merged with `--squash`.

For example, a subtree merged like:

    git subtree merge --squash --prefix=subA/subB "$rev"
    #                 ^^^^^^^^          ^^^^

is erroneously ignored during a split of `subA`. This causes
missing tree files and different commit hashes starting in
git v2.44.0-rc0.

The method:

    should_ignore_subtree_split_commit REV

should test only a single commit REV, but the combination of

    git log -1 --grep=...

actually searches all *parent* commits until a `--grep` match is
discovered.

Rewrite this method to test only one REV at a time. Extract commit
information with a single `git` call as opposed to three. The
`test` conditions for rejecting a commit remain unchanged.

Unit tests now cover nested subtrees.

Signed-off-by: Colin Stagner <ask+git@howdoi.land>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-09-11 09:01:15 -07:00
..
t contrib/subtree: fix split with squashed subtrees 2025-09-11 09:01:15 -07:00
.gitignore contrib/subtree: fix building docs 2025-01-17 09:56:37 -08:00
COPYING
INSTALL
Makefile contrib/subtree: rename .txt to .adoc 2025-03-01 10:00:52 -08:00
README doc: update references to renamed AsciiDoc files 2025-06-06 15:05:47 -07:00
git-subtree.adoc contrib/subtree: add -S/--gpg-sign 2025-06-04 09:32:17 -07:00
git-subtree.sh contrib/subtree: fix split with squashed subtrees 2025-09-11 09:01:15 -07:00
meson.build meson: introduce kwargs variable for tests 2025-06-02 07:51:43 -07:00
todo subtree: give the docs a once-over 2021-04-28 16:47:19 +09:00

README

Please read git-subtree.adoc for documentation.

Please don't contact me using github mail; it's slow, ugly, and worst of
all, redundant. Email me instead at apenwarr@gmail.com and I'll be happy to
help.

Avery