Re: [PATCH] [Outreachy PATCH] t4041: use submodule repository for commit abbreviations
- From
- Okhuomon Ajayi <okhuomonajayi54@gmail.com>
- Date
- Oct 31, 2026, 16:46 UTC
- Message-ID
- <CAFpMFfALb1KbEw-dc4wYCxS4PXfDBwzQOD6YPRe52_bpRnGt9w@mail.gmail.com>
- In-Reply-To
- <pull.2288.git.1793435149942.gitgitgadget@gmail.com>
Hi Srujith,
I applied this on top of master and ran t4041. The new test fails without the submodule.c change and passes with it, so it does catch the problem.
A few small things:
On Sat, Oct 31, 2026 at 9:26 AM Srujith A Poojary via GitGitGadget <gitgitgadget@gmail.com> wrote:
> Use the submodule repository when abbreviating commit IDs in > submodule diff headers, so uniqueness is checked against the > correct object database.
It would help to first describe what happens today: the commit IDs in the "Submodule ..." header are abbreviated against the superproject's objects, even though the commits live in the submodule, so the abbreviation may not be unique there.
> [Outreachy PATCH] t4041: use submodule repository for commit > abbreviations
The change itself is in submodule.c, so the title might read better with that area, e.g. "submodule: use the submodule repository to abbreviate commits".
Show 5 quoted lines
> - strbuf_add_unique_abbrev(&sb, one, DEFAULT_ABBREV); > + if (sub) > + strbuf_repo_add_unique_abbrev(&sb, sub, one, DEFAULT_ABBREV); > + else > + strbuf_add_unique_abbrev(&sb, one, DEFAULT_ABBREV);
The same if/else appears twice. Maybe choose the repository once, at the top of the function, and call strbuf_repo_add_unique_abbrev() with it in both places. I also wonder whether the fallback could be o->repo instead of the_repository, since the diff options already carry a repository.
Thanks, Okhuomon