diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index aac2b97bf..a44d02d91 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -1728,7 +1728,9 @@ external dependencies (including libraries) must go to "dependencies".''') vcs_cmd = kwargs['command'] source_dir = os.path.normpath(os.path.join(self.environment.get_source_dir(), self.subdir)) if vcs_cmd: - vcs_cmd[0] = self.find_program_impl(vcs_cmd[0]) + maincmd = self.find_program_impl(vcs_cmd[0], required=False) + if maincmd.found(): + vcs_cmd[0] = maincmd else: vcs = mesonlib.detect_vcs(source_dir) if vcs: diff --git a/test cases/common/66 vcstag/meson.build b/test cases/common/66 vcstag/meson.build index 256d2e951..520f72aa1 100644 --- a/test cases/common/66 vcstag/meson.build +++ b/test cases/common/66 vcstag/meson.build @@ -9,9 +9,15 @@ output : 'vcstag-custom.c', command : ['git', 'show-ref', '-s', 'refs/heads/master'], fallback : '1.0.0') +version_src_notfound_fallback = vcs_tag(input : 'vcstag.c.in', +output : 'vcstag-notfound-fallback.c', +command : ['git-but-not-found-sorry', 'show-ref', '-s', 'refs/heads/master'], +fallback : '1.0.0') + version_src_fallback = vcs_tag(input : 'vcstag.c.in', output : 'vcstag-fallback.c') executable('tagprog', 'tagprog.c', version_src) executable('tagprog-custom', 'tagprog.c', version_src_custom) executable('tagprog-fallback', 'tagprog.c', version_src_fallback) +executable('tagprog-notfound-fallback', 'tagprog.c', version_src_notfound_fallback)