meson: prevent finding sed(1) in a loop

We're searching for the sed(1) executable in a loop, which will make us try to find it multiple times. Starting with the preceding commit we already declare a variable for that program in the top-level build file. Use it so that we only need to search for the program once. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Feb 26, 2025 at 09:22 UTC 16c89dcf80b742276d927b99fe28dbcde1469417
2 files changed +3 -2
Documentation/howto/meson.build
+1 -1
@@ -41,7 +41,7 @@ custom_target(
41 foreach howto : howto_sources
42 howto_stripped = custom_target(
43 command: [
44 - find_program('sed'),
44 + sed,
45 '-e',
46 '1,/^$/d',
47 '@INPUT@',
meson.build
+2 -1
@@ -201,11 +201,12 @@ endif
201 cygpath = find_program('cygpath', dirs: program_path, required: false)
202 diff = find_program('diff', dirs: program_path)
203 git = find_program('git', dirs: program_path, required: false)
204 +sed = find_program('sed', dirs: program_path)
205 shell = find_program('sh', dirs: program_path)
206 tar = find_program('tar', dirs: program_path)
207
208 # Sanity-check that programs required for the build exist.
208 -foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
209 +foreach tool : ['cat', 'cut', 'grep', 'sort', 'tr', 'uname']
210 find_program(tool, dirs: program_path)
211 endforeach
212