Subject: Re: [PATCH 6/8] meson: fix GIT_EXEC_PATH with overridden -Dlibexecdir=

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 8 Jul 2025 10:44:23 +0200

On Thu, Jul 03, 2025 at 05:39:31PM +0100, Ramsay Jones wrote:
> 
> 
> On 03/07/2025 10:28, Patrick Steinhardt wrote:
> > In 837f637cf51 (meson.build: correct setting of GIT_EXEC_PATH,
> > 2025-05-19) we have fixed how we configure GIT_EXEC_PATH in some cases.
> > It was reported [1] though that this causes a new issue when overriding
> > libexecdir with `-Dlibexecdir=`:
> 
> Yep, I noticed this report when I got back. My first thought was 'no, we
> may just as well revert commit 837f637cf51', since that is in effect what
> this patch does! ;)
> 
> Then I had a quick look and left a diff/commit 'note to myself' which
> effectively did a global search/replace of the string:
> 
>     install_dir: get_option('libexecdir') / 'git-core'
> 
> with:
> 
>     install_dir: git_exec_path
> 
> and put it on my TODO list. (Note, that is *all* I did - I didn't even
> attempt a build, let alone test!)
> 
> Of course, I need to spend some time on this (if nothing else, git-gui and
> presumably gitk will need some changes as well?).

Neither git-gui nor gitk are currently supported by Meson. I do have a
local patch series that backfills the support though.

> Hopefully, I can find some time soon (those round tuits are in short supply).
> 
> > 
> >     $ meson setup -Dprefix=/tmp/git -Dlibexecdir=libexec-different
> >     $ meson install
> >     $ /tmp/git/bin/git --exec-path
> >     /tmp/git/libexec-different
> >     $ /tmp/git/bin/git daemon
> >     git: 'daemon' is not a git command. See 'git --help'.
> > 
> > While we correctly propagate the libexecdir to Git's GIT_EXEC_PATH, we
> > forgot to append 'git-core'. Consequently, it cannot find its binaries
> > anymore.
> > 
> > Fix this issue by appending 'git-core' to libexecdir. With this, things
> > work as expected:
> > 
> >     $ meson install
> >     $ /tmp/git/bin/git --exec-path
> >     /tmp/git/libexec-different/git-core
> >     $ /tmp/git/bin/git daemon -h
> >     ...
> 
> Hmm, I'm pretty certain I tested commit 837f637cf51 in a similar (but
> not identical) way! ;) I will use the above test next time.
> 
> Sorry for causing a regression. :(

No worries, it happens to all of us.

Patrick