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

Re: [PATCH v2] revision: add `--ignore-missing-links` user option

From
Karthik Nayak <karthik.188@gmail.com>
Date
Sep 13, 2023, 09:32 UTC
Message-ID
<CAOLa=ZSVobP9Be9W3f1BWoZjLUYwOqOpCQMCXVH34=iGKfXnmw@mail.gmail.com>
In-Reply-To
<ZQCa3GHT3D7aibJ1@nand.local>
On Tue, Sep 12, 2023 at 7:07 PM Taylor Blau <me@ttaylorr.com> wrote:
Show 12 quoted lines
> > +# We create 5 commits and move them to the alt directory and
> > +# create 5 more commits which will stay in the main odb.
> > +test_expect_success 'create repository and alternate directory' '
> > +     git init main &&
>
> We don't necessarily have to initialize a repository, as the test suite
> already does so for us. So we may want to write this instead as:
>
>     test_commit_bulk 5 &&
>     git clone --reference=. --shared . alt &&
>     test_commit_bulk -C alt --start=6 5
>

I was trying to use the env variable `GIT_ALTERNATE_OBJECT_DIRECTORIES` and get hence ended up creating a new repository. But I really like the convenience functions that you've suggested below. With that, this seems like the way to go.

Show 29 quoted lines
> > +# when the alternate odb is provided, all commits are listed along with the boundary
> > +# commit.
> > +test_expect_success 'rev-list passes with alternate object directory' '
> > +     GIT_ALTERNATE_OBJECT_DIRECTORIES=$PWD/alt git -C main rev-list HEAD >actual &&
> > +     test_stdout_line_count = 10 cat actual &&
> > +     grep $BOUNDARY_COMMIT actual
> > +'
>
> Here, I think we'd want to make sure that we have not just 10 lines of
> output, but that they are the 10 that we expect, like so:
>
>     git -C alt rev-list --all --objects --no-object-names >actual.raw &&
>     {
>       git rev-list --all --objects --no-object-names &&
>       git -C alt rev-list --all --objects --no-object-names --not \
>         --alternate-refs
>     } >expect.raw &&
>     sort actual.raw >actual &&
>     sort expect.raw >expect &&
>     test_cmp expect actual
>
> When reviewing this and tweaking some of the tests locally, I found it
> useful to have some convenience functions like "hide_alternates" and
> "show_alternates" to control whether or not "alt" could see its
> alternate or not.
>
> From my review locally, the resulting changes (which can be applied
> directly on top of your patch here look like):
>

This is much better. I didn't know about `test_oid_to_path` and `test_when_finished`, and overall your patch looks much nicer and is more thorough in the testing. I'll add it to the next version. Will wait a day or two for more feedback before I submit v3.

Thanks again for your review and the patch :)
Previous: Taylor BlauNext: Taylor Blau
Message 6 of 20 in “revision: add `--ignore-missing-links` user option”
  1. revision: add `--ignore-missing-links` user optionKarthik Nayak, Sep 8, 2023
  2. Junio C HamanoSep 8, 2023
  3. Karthik NayakSep 12, 2023
  4. revision: add `--ignore-missing-links` user optionKarthik Nayak, Sep 12, 2023
  5. Taylor BlauSep 12, 2023
  6. Karthik NayakSep 13, 2023
  7. Taylor BlauSep 13, 2023
  8. revision: add `--ignore-missing-links` user optionKarthik Nayak, Sep 15, 2023
  9. Junio C HamanoSep 15, 2023
  10. Karthik NayakSep 18, 2023
  11. Junio C HamanoSep 18, 2023
  12. Karthik NayakSep 19, 2023
  13. Junio C HamanoSep 19, 2023
  14. revision: add `--ignore-missing-links` user optionKarthik Nayak, Sep 20, 2023
  15. Junio C HamanoSep 20, 2023
  16. Karthik NayakSep 21, 2023
  17. Junio C HamanoSep 21, 2023
  18. Karthik NayakSep 24, 2023
  19. Junio C HamanoSep 25, 2023
  20. Karthik NayakSep 27, 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.