[PATCH] meson: correct git detection

John Levon posted 1 patch 3 months, 1 week ago
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] meson: correct git detection
Posted by John Levon 3 months, 1 week ago
The current "building from git" test uses "test -d .git"; however, that
doesn't work when libvirt is used as a submodule, as in that case .git
is a normal file. Use "test -e .git" instead.

Signed-off-by: John Levon <john.levon@nutanix.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 3ab8e57e4a..231470e2ee 100644
--- a/meson.build
+++ b/meson.build
@@ -17,7 +17,7 @@ endif
 
 # figure out if we are building from git
 
-git = run_command('test', '-d', '.git', check: false).returncode() == 0
+git = run_command('test', '-e', '.git', check: false).returncode() == 0
 
 if git and not get_option('no_git')
   run_command('git', 'submodule', 'update', '--init', check: true)
-- 
2.34.1
Re: [PATCH] meson: correct git detection
Posted by Michal Prívozník 3 months, 1 week ago
On 7/24/24 10:56, John Levon wrote:
> The current "building from git" test uses "test -d .git"; however, that
> doesn't work when libvirt is used as a submodule, as in that case .git
> is a normal file. Use "test -e .git" instead.
> 
> Signed-off-by: John Levon <john.levon@nutanix.com>
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal