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

Re: [PATCH] [Outreachy PATCH] t4041: use submodule repository for commit abbreviations

From
SPSrujith Poojary <poojarysrujith@gmail.com>
Date
Oct 31, 2026, 19:08 UTC
Message-ID
<CABh_KWh0N0y7rN61wx5=zQWs3QmD8Ho6ONig75ocj8zFWKh4bw@mail.gmail.com>
In-Reply-To
<CAFpMFfALb1KbEw-dc4wYCxS4PXfDBwzQOD6YPRe52_bpRnGt9w@mail.gmail.com>

On Sat, Oct 31, 2026 at 10:16 PM Okhuomon Ajayi <okhuomonajayi54@gmail.com> wrote:

Show 41 quoted lines
>
> 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".
>
> > - 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
Hi Okhuomon,
Thanks for reviewing the patch and testing the new test case.

I've made the suggested changes and submitted v2. I now use `sub` when available and fall back to `o->repo` when it isn't. I also simplified the code and updated the commit message.

Here is the updated patch: https://lore.kernel.org/git/pull.2288.v2.git.1793473062113.gitgitgadget@gmail.com

Thanks again!

Regards, Srujith

Previous: Okhuomon AjayiNext: Srujith A Poojary via GitGitGadget
Message 3 of 7 in “t4041: use submodule repository for commit abbreviations”
  1. [Outreachy PATCH] t4041: use submodule repository for commit abbreviationsSrujith A Poojary via GitGitGadget, Oct 31, 2026
  2. Okhuomon AjayiOct 31, 2026
  3. Srujith PoojaryOct 31, 2026
  4. Submodule: use the submodule repository to abbreviate commitsSrujith A Poojary via GitGitGadget, Oct 31, 2026
  5. Okhuomon AjayiOct 31, 2026
  6. Srujith PoojaryOct 31, 2026
  7. submodule: use the submodule repository to abbreviate commitsSrujith A Poojary via GitGitGadget, Oct 31, 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.