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

Re: [Bug] In `git-rev-list(1)`, using the `--objects` flag doesn't work well with the `--not` flag, as non-commit objects are not excluded

From
Taylor Blau <me@ttaylorr.com>
Date
Aug 15, 2023, 22:11 UTC
Message-ID
<ZNv3+xOCi920StXO@nand.local>
In-Reply-To
<xmqqttt0hzl2.fsf@gitster.g>
On Tue, Aug 15, 2023 at 12:31:37PM -0700, Junio C Hamano wrote:
Show 13 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
> > If you notice here, the objects
> > `8baef1b4abc478178b004d62031cf7fe6db6f903`,
> > `086885f71429e3599c8c903b0e9ed491f6522879` and
> > `7a67abed5f99fdd3ee203dd137b9818d88b1bafd` are included in the output,
> > these objects are reachable from
> > `91fa9611a355db77a07f963c746d57f75af380da` and shouldn't have been
> > included since we used the `--not` flag.
>
> For performance reasons, we cannot afford to enumerate all objects
> that are reachable from --not objects and exclude them from the
> output.  So it is a balancing act to decide where to draw the line.

As a hack, you can exploit the existing bitmap traversal routine to build up an exact mapping of what is and isn't on either side of your reachability query.

IOW, if you run:
    git repack -ad --write-bitmap-index

and then repeat the rev-list query with `--use-bitmap-index`, you should get exact results.

Note that this will only work if pack.useBitmapBoundaryTraversal is set to false, since the boundary-based traversal that is behind that configuration option is susceptible to the same one-sided error.

Thanks, Taylor

Previous: Junio C HamanoNext: Karthik Nayak
Message 3 of 8 in “[Bug] In `git-rev-list(1)`, using the `--objects` flag doesn't work well with the `--not` flag, as non-commit objects are not excluded”
  1. Karthik NayakAug 15, 2023
  2. Junio C HamanoAug 15, 2023
  3. Taylor BlauAug 15, 2023
  4. Karthik NayakAug 15, 2023
  5. Karthik NayakAug 15, 2023
  6. Junio C HamanoAug 16, 2023
  7. Karthik NayakAug 16, 2023
  8. Junio C HamanoAug 15, 2023

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.