Skip to content

A handful of fixes for Meson#31

Open
pks-gitlab wants to merge 4 commits intoj6t:masterfrom
pks-gitlab:pks-meson-fixes
Open

A handful of fixes for Meson#31
pks-gitlab wants to merge 4 commits intoj6t:masterfrom
pks-gitlab:pks-meson-fixes

Conversation

@pks-gitlab
Copy link

This PR contains a handful of fixes for Meson:

  • The version generation didn't properly work when git-gui is embedded into a parent project, and in fact it only works coincidentally with the Makefile.
  • Prefer "/bin/sh" over any other shell.
  • Wire up git-gui--askyesno, and also adapt our Makefile to properly massage the script to propagate our build options.

The GIT-VERSION-GEN script sets up GIT_CEILING_DIRECTORIES so that we
won't accidentally parse version information from an unrelated parent
repository. The ceiling is derived from the source directory by simply
appendign "/.." to it, which mean that we'll only consider the current
directory for repository discovery.

This works alright in the case where git-gui is built as a standalone
project, but it breaks when git-gui is embedded into a _related_ parent
project. This is for example how git-gui is distributed via Git.

Interestingly enough, the version information is still derived properly
when building git-gui via Git's Makefile. In that case we eventually end
up specifying the ceiling directory as "./.." as we use relative paths
there, and that seems to not restrict the repository discovery.

But when building via Meson we specify the source directory as an
absolute path, and if so the repository discovery _is_ stopped. The
consequence is that we won't be able to derive the version in that case.

Fix the issue by adding a new optional parameter to GIT-VERSION-GEN that
allows the caller to override the parent project directory and wire up
new build options for Meson and Make that allows users to specify it.

Note that by default we won't set the parent project directory. This
isn't required for Meson anyway as we already use absolute paths there,
but for our Makefile it means that we still end up with "./.." as
ceiling directory, which is ineffective. But using e.g. pwd(1) as the
default value would break downstream's version generation, unless we
updated git-gui and the Makefile at the same point in time.

Signed-off-by: Patrick Steinhardt <[email protected]>
Meson detects the path of the target shell via `find_program("sh")`,
which essentially does a lookup via `PATH`. We know that almost all
systems have "/bin/sh" available though, which makes it the superior
choice as a default value.

Adapt `find_program()` to prefer "/bin/sh" over any other "sh"
executable.

Signed-off-by: Patrick Steinhardt <[email protected]>
In e749c87 (git-gui: provide question helper for retry fallback on
Windows, 2025-08-28) we have introudced a new "git-gui--askyesno" helper
script. While the script is conceptually similar to our existing helper
script "git-gui--askpass", we don't massage it via "generate-script.sh".
This means that build options like the path to the wish shell are not
propagated correctly.

Fix this issue.

Signed-off-by: Patrick Steinhardt <[email protected]>
The new "git-gui--askyesno" helper script has only been wired up for our
Makefile, not for Meson. Wire it up properly to bring both build systems
on par with each other again.

Signed-off-by: Patrick Steinhardt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants