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

Re: [PATCH v2 2/4] commit: write commit-graph with Bloom filters

From
Taylor Blau <me@ttaylorr.com>
Date
Apr 15, 2020, 00:17 UTC
Message-ID
<20200415001713.GB7457@syl.local>
In-Reply-To
<36f321b9-e2ff-60c3-637a-38682ee5d9f0@gmail.com>
On Tue, Apr 14, 2020 at 01:40:53PM -0400, Derrick Stolee wrote:
Show 30 quoted lines
> On 4/14/2020 1:26 PM, Junio C Hamano wrote:
> > Derrick Stolee <stolee@gmail.com> writes:
> >
> >> On 4/13/2020 6:21 PM, Junio C Hamano wrote:
> >>> Taylor Blau <me@ttaylorr.com> writes:
> >>>
> >>>> Hmm. I'm not crazy about a library function looking at 'GIT_TEST_*'
> >>>> environment variables and potentially ignoring its arguments, but given
> >>>> the discussion we had in v1, I don't feel strongly enough to recommend
> >>>> that you change this.
> >>>>
> >>>> For what it's worth, I think that 'write_commit_graph' could behave more
> >>>> purely if callers checked 'GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS' and set
> >>>> 'flags' appropriately from the outside,...
> >>>
> >>> Yeah, I agree that it would be a lot cleaner if that is easy to
> >>> arrange.  I have a suspicion that Derrick already tried and the
> >>> resulting code looked messier and was discarded?
> >>
> >> Perhaps I could fix both concerns by
> >>
> >> 1. Use a macro instead of a library call.
> >>
> >> 2. Check the _CHANGED_PATHS variable in the macro.
> >
> > I am not sure how use of a macro "fixes" purity, though.  And what
> > is the other concern?
>
> The concern was (1) checking the environment and (2) die()ing in the
> library.

I think that we might as well use a plain old function here instead of a macro, especially since the macro is just expanding out to what that function would be if we had written it that way.

For what it's worth, my concern was more that I don't mind dying, but I'd rather do so in a calling function, and that by the time we're calling 'write_commit_graph', that we should be using return values instead of 'die()' or 'error()'.

Show 16 quoted lines
> > How widely would this "if we are testing, write out the graph file"
> > call be sprinkled over the codebase?  I am hoping that it won't be
> > "everywhere", but only at strategic places (like "just once before
> > we leave a subcommand that creates one or bunch of commits").  And
> > how often would they be called?  I am also hoping that it won't be
> > "inside a tight loop".  In short, I am wondering if we can promise
> > our codebase that
> >
> >  - git_test_write_commit_graph_or_die() calls won't be an eyesore
> >    (and/or distraction) for developers too much.
> >
> >  - git_env_bool() call won't have performance impact.
>
> I could add a comment to the header file to say "this is only for
> improving coverage of optional features in the test suite. Do not
> call this method unless you know what you are doing."
Works for me.
> My intention right now is to only include this in 'git commit'
> and 'git merge'. Earlier discussion included thoughts about
> 'git rebase' and similar, but those are more rarely used when
> constructing an "example repo" in the test scripts.

Ditto. I think that there's benefit in having it in some places but not all (as Stolee pointed out earlier in the thread), and that trying to have it everywhere is a fool's errand.

> -Stolee

Thanks, Taylor

Previous: Derrick StoleeNext: Derrick Stolee via GitGitGadget
Message 40 of 48 in “Integrate changed-path Bloom filters with 'git blame'”
  1. 0/3 Integrate changed-path Bloom filters with 'git blame'Derrick Stolee via GitGitGadget, Apr 11, 2020
  2. 1/3 revision: complicated pathspecs disable filtersDerrick Stolee via GitGitGadget, Apr 11, 2020
  3. Junio C HamanoApr 11, 2020
  4. Derrick StoleeApr 13, 2020
  5. Junio C HamanoApr 14, 2020
  6. Derrick StoleeApr 15, 2020
  7. Derrick StoleeApr 15, 2020
  8. Junio C HamanoApr 15, 2020
  9. Junio C HamanoApr 15, 2020
  10. Junio C HamanoApr 15, 2020
  11. Taylor BlauApr 16, 2020
  12. Jakub NarębskiApr 15, 2020
  13. Taylor BlauApr 16, 2020
  14. Derrick StoleeApr 16, 2020
  15. Taylor BlauApr 16, 2020
  16. Junio C HamanoApr 16, 2020
  17. Taylor BlauApr 12, 2020
  18. Junio C HamanoApr 12, 2020
  19. Taylor BlauApr 13, 2020
  20. Derrick StoleeApr 13, 2020
  21. 2/3 commit: write commit-graph with bloom filtersDerrick Stolee via GitGitGadget, Apr 11, 2020
  22. Junio C HamanoApr 11, 2020
  23. Taylor BlauApr 12, 2020
  24. Derrick StoleeApr 13, 2020
  25. Junio C HamanoApr 13, 2020
  26. 3/3 blame: use changed-path Bloom filtersDerrick Stolee via GitGitGadget, Apr 11, 2020
  27. Junio C HamanoApr 11, 2020
  28. Eric SunshineApr 12, 2020
  29. Junio C HamanoApr 11, 2020
  30. 0/4 Integrate changed-path Bloom filters with 'git blame'Derrick Stolee via GitGitGadget, Apr 13, 2020
  31. 1/4 revision: complicated pathspecs disable filtersDerrick Stolee via GitGitGadget, Apr 13, 2020
  32. Taylor BlauApr 13, 2020
  33. Junio C HamanoApr 13, 2020
  34. 2/4 commit: write commit-graph with Bloom filtersDerrick Stolee via GitGitGadget, Apr 13, 2020
  35. Taylor BlauApr 13, 2020
  36. Junio C HamanoApr 13, 2020
  37. Derrick StoleeApr 14, 2020
  38. Junio C HamanoApr 14, 2020
  39. Derrick StoleeApr 14, 2020
  40. Taylor BlauApr 15, 2020
  41. 3/4 commit-graph: write commit-graph in more testsDerrick Stolee via GitGitGadget, Apr 13, 2020
  42. 4/4 blame: use changed-path Bloom filtersDerrick Stolee via GitGitGadget, Apr 13, 2020
  43. Taylor BlauApr 13, 2020
  44. 0/3 Integrate changed-path Bloom filters with 'git blame'Derrick Stolee via GitGitGadget, Apr 16, 2020
  45. 1/3 revision: complicated pathspecs disable filtersDerrick Stolee via GitGitGadget, Apr 16, 2020
  46. SZEDER GáborJun 7, 2020
  47. 2/3 tests: write commit-graph with Bloom filtersDerrick Stolee via GitGitGadget, Apr 16, 2020
  48. 3/3 blame: use changed-path Bloom filtersDerrick Stolee via GitGitGadget, Apr 16, 2020

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.