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

Re: [PATCH] commit-reach: parse commits in the given repository

From
Kristofer Karlsson <krka@spotify.com>
Date
Sep 16, 2026, 14:55 UTC
Message-ID
<CAL71e4PRqawd=2DfLELLXR2g0PFz2ehXf05uLXJKF92WiztO9w@mail.gmail.com>
In-Reply-To
<20260916134632.1424829-1-orestisflo@gmail.com>
On Wed, 16 Sept 2026 at 16:00, Orestis Floros <orestisflo@gmail.com> wrote:
Show 40 quoted lines
> +test_expect_success 'setup for commit-graphs in superproject and submodule' '
> +       git init commit-graph &&
> +       (cd commit-graph &&
> +       git init sub &&
> +       for i in 1 2 3 4 5 6 7 8 9 10
> +       do
> +               test_commit -C sub "sub-$i" || return 1
> +       done &&
> +
> +       git -C sub checkout --detach sub-1 &&
> +       git add sub &&
> +       git commit -m base &&
> +
> +       # Write the commit-graph of the superproject while it only
> +       # contains a single commit. Any commit-graph position of the
> +       # submodule is thus out of bounds for the superproject.
> +       git commit-graph write --reachable &&
> +
> +       git checkout -b side &&
> +       git -C sub checkout --detach sub-5 &&
> +       git add sub &&
> +       git commit -m side &&
> +
> +       git checkout main &&
> +       git -C sub checkout --detach sub-10 &&
> +       git add sub &&
> +       git commit -m main &&
> +
> +       git -C sub commit-graph write --reachable)
> +'
> +
> +test_expect_success 'merge does not mix up superproject and submodule commit-graphs' '
> +       (cd commit-graph &&
> +       git merge side &&
> +       git rev-parse HEAD:sub >actual &&
> +       git -C sub rev-parse sub-10^{commit} >expect &&
> +       test_cmp expect actual)
> +'
> +
>  test_done

I ran the new tests with and without the code change and can confirm it reproduces the bug.

The code makes sense to me. As a bonus, this brings commit-reach.c down from 17 to 11 the_repository references, getting us slightly closer to eventually dropping USE_THE_REPOSITORY_VARIABLE there.

- Kristofer
Previous: Orestis FlorosNext: Junio C Hamano
Message 4 of 6 in “[BUG] "commit graph is likely corrupt" on git rebase”
  1. Florian SchmidtJul 31, 2026
  2. Patrick SteinhardtAug 10, 2026
  3. commit-reach: parse commits in the given repositoryOrestis Floros, Sep 16, 2026
  4. Kristofer KarlssonSep 16, 2026
  5. Junio C HamanoSep 16, 2026
  6. Patrick SteinhardtSep 23, 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.