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

Re: [PATCH 2/2] send-email: don't needlessly abs_path() the core.hooksPath

From
Robert Foss <robert.foss@linaro.org>
Date
May 25, 2021, 06:21 UTC
Message-ID
<CAG3jFyu8AzSJS2EZwYKD9YKiewLVQLeKZZYEvUobyV+a6_VsDw@mail.gmail.com>
In-Reply-To
<871r9vnxtb.fsf@evledraar.gmail.com>
On Tue, 25 May 2021 at 08:15, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 46 quoted lines
>
>
> On Tue, May 25 2021, Ævar Arnfjörð Bjarmason wrote:
>
> > On Tue, May 25 2021, Junio C Hamano wrote:
> >
> >> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> >>
> >>> In c8243933c74 (git-send-email: Respect core.hooksPath setting,
> >>> 2021-03-23) we started supporting core.hooksPath in "send-email". It's
> >>> been reported that on Windows[1] doing this by calling abs_path()
> >>> results in different canonicalizations of the absolute path.
> >>
> >> I see the author of that patch CC'ed; the change in question
> >> explains why we switched from "the hooks directory immediately under
> >> $repo->repo_path()" to "ask 'rev-parse --git-path hooks'", but it
> >> does not say why we call abs_path() on the result.  I guess that is
> >> because $repo->repo_path() has always been a result of applying the
> >> abs_path() function to something, so it was to safeguard the callers
> >> that expect an absolute path coming back from hooks_path?
> >>
> >> And that makes this change dubious, especially as a band-aid for a
> >> breakage immediately before the final release, doesn't it?  Are we
> >> convinced that the callers are OK with seeing sometimes relative
> >> paths?  Certainly the cases the tests J6t fixed are not negatively
> >> affected, but is that sufficient?  To what directory is the
> >> configuration variable supposed to be relative to, and are we sure
> >> that the user will always invoke "git send-email" from that
> >> directory?
> >
> > The one caller is git-send-email.perl is fine with it, at least on *nix,
> > this fix still needs testing on Windows.
> >
> > The repo_path() function was introduced in c8243933c74, so it's never
> > been in a release, thus I think it's fine to alter its behavior.
> >
> > The code here doesn't need to concern itself with what needs to be
> > relative to what, you run send-email in some working tree directory (or
> > top-level), and depending on core.hooksPath we'll either return a
> > relative path to the .git/hooks or an absolute one, the system()
> > invocation will accept either.
>
> ...I think the one issue with my 2/2 is that it doesn't go far enough,
> we should just remove the repo_path() from Git.pm and instead use its:
>
>     $self->command_oneline('rev-parse', '--git-path', 'hooks')
This looks good to me.
Show 9 quoted lines
>
> ...in the one user in git-send-email.perl, as discussed in other
> serieses Git.pm is "public", so stuff we stick in there we can't
> alter. In this case we're doing so before a release, and nobody wanted
> this except git-send-email.perl.
>
> That caller is likely to just go away if and when Emily's "git hook run"
> lands, so I think it would be best (but not strictly needed for the
> pre-rc fix) to just remove that API.

That sounds like a sane approach. If core.hooksPath is needed in more locations in the future, it can be added then.

>
> What do you / Robert Foss think (maybe he wanted this for something
> else...)?
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 12 of 20 in “t9001-send-email.sh: fix expected absolute paths on Windows”
  1. t9001-send-email.sh: fix expected absolute paths on WindowsJohannes Sixt, May 24, 2021
  2. Jonathan NiederMay 24, 2021
  3. Ævar Arnfjörð BjarmasonMay 24, 2021
  4. Ævar Arnfjörð BjarmasonMay 24, 2021
  5. 0/2 send-email: pre-release fixes for v2.32.0Ævar Arnfjörð Bjarmason, May 24, 2021
  6. 1/2 send-email: fix missing error message regressionÆvar Arnfjörð Bjarmason, May 24, 2021
  7. 2/2 send-email: don't needlessly abs_path() the core.hooksPathÆvar Arnfjörð Bjarmason, May 24, 2021
  8. Junio C HamanoMay 25, 2021
  9. Robert FossMay 25, 2021
  10. Ævar Arnfjörð BjarmasonMay 25, 2021
  11. Ævar Arnfjörð BjarmasonMay 25, 2021
  12. Robert FossMay 25, 2021
  13. Junio C HamanoMay 25, 2021
  14. Ævar Arnfjörð BjarmasonMay 25, 2021
  15. Junio C HamanoMay 25, 2021
  16. 0/2 send-email: don't needlessly abs_path() the core.hooksPathÆvar Arnfjörð Bjarmason, May 26, 2021
  17. 1/2 send-email: don't needlessly abs_path() the core.hooksPathÆvar Arnfjörð Bjarmason, May 26, 2021
  18. 2/2 send-email: move "hooks_path" invocation to git-send-email.perlÆvar Arnfjörð Bjarmason, May 26, 2021
  19. Felipe ContrerasMay 26, 2021
  20. Johannes SchindelinJun 2, 2021

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.