]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: fix git ls-files invocations during rebase
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 8 Jan 2021 19:27:48 +0000 (20:27 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 9 Jan 2021 00:22:26 +0000 (09:22 +0900)
Normally ls-files prints the full path to files from the repo root. But when
$GIT_WORK_TREE is set, ls-files prints paths relative to the current
directory. When rebasing, $GIT_WORK_TREE is set in the commands executed from
'rebase -x'. This causes problems if meson config is touched and the meson
reconfigures itself. ($GIT_WORK_TREE shouldn't be relevant, since the paths that
ls-files reports don't depend on the work tree, but whatever.) Let's unset
GIT_WORK_TREE to avoid the issue.

$ (cd test; git --git-dir=$PWD/../.git ls-files ':/test/dmidecode-dumps/*.bin')
test/dmidecode-dumps/HP-Z600.bin
test/dmidecode-dumps/Lenovo-ThinkPad-X280.bin
test/dmidecode-dumps/Lenovo-Thinkcentre-m720s.bin

$ (cd test; GIT_WORK_TREE=$PWD/.. git --git-dir=$PWD/../.git ls-files ':/test/dmidecode-dumps/*.bin')
dmidecode-dumps/HP-Z600.bin
dmidecode-dumps/Lenovo-ThinkPad-X280.bin
dmidecode-dumps/Lenovo-Thinkcentre-m720s.bin

Fixes #18148.

meson.build
test/fuzz/meson.build
test/meson.build

index 6573046c439882d2779ac5b454a926a5f965e46e..aedde9b94e9dc289b858650c04f3ccc00577bef0 100644 (file)
@@ -3651,10 +3651,11 @@ endforeach
 
 if git.found()
         all_files = run_command(
+                'env', '-u', 'GIT_WORK_TREE',
                 git,
-                ['--git-dir=@0@/.git'.format(project_source_root),
-                 'ls-files',
-                 ':/*.[ch]'])
+                '--git-dir=@0@/.git'.format(project_source_root),
+                'ls-files', ':/*.[ch]')
+
         all_files = files(all_files.stdout().split())
 
         custom_target(
index 7a83961d11cb5571c161d4d517a508bfd919e87a..fc8033dbbee9e270386d0270aae40dd561c02a17 100644 (file)
@@ -23,9 +23,10 @@ sanitizers = [['address,undefined', sanitize_address_undefined]]
 
 if git.found()
         out = run_command(
+                'env', '-u', 'GIT_WORK_TREE',
                 git,
                 '--git-dir=@0@/.git'.format(project_source_root),
-                 'ls-files', ':/test/fuzz/*/*')
+                'ls-files', ':/test/fuzz/*/*')
 else
         out = run_command(
                 'sh', '-c', 'ls @0@/test/fuzz/*/*'.format(project_source_root))
index 1e8a56aa90a8214e1be505446d5d637a2bb440ca..2785dc92a7772b6642eaf2b83a7bb92953df7e62 100644 (file)
@@ -142,6 +142,7 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
 
         if git.found()
                 out = run_command(
+                        'env', '-u', 'GIT_WORK_TREE',
                         git,
                         '--git-dir=@0@/.git'.format(project_source_root),
                         'ls-files', ':/test/dmidecode-dumps/*.bin')