git-gui: honor TCLTK_PATH in git-gui--askpass
Since its introduction in 8c76212 (git-gui: Add a simple implementation of SSH_ASKPASS., 2008-10-15), git-gui--askpass has been calling whatever wish interpreter is in the path, unlike git-gui. Correct that by turning it into a script that would be processed at build time. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Carlo Marcelo Arenas Belón committed
Jul 31, 2025 at 01:06 UTC
0e3233b91393e3b5f21c310f202797a603294e0d
5 files changed
+42
-10
.gitignore
+1
@@ -4,4 +4,5 @@ git-gui.tcl
4
GIT-GUI-BUILD-OPTIONS
5
GIT-VERSION-FILE
6
git-gui
7
+git-gui--askpass
8
lib/tclIndex
Makefile
+5
-2
@@ -173,10 +173,13 @@ GIT-GUI-BUILD-OPTIONS: FORCE
173
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
174
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
175
176
+git-gui--askpass: git-gui--askpass.sh GIT-GUI-BUILD-OPTIONS generate-script.sh
177
+ $(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS
178
+
179
ifdef GITGUI_WINDOWS_WRAPPER
180
all:: git-gui
181
endif
179
-all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
182
+all:: $(GITGUI_MAIN) git-gui--askpass lib/tclIndex $(ALL_MSGFILES)
183
184
install: all
185
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
@@ -215,7 +218,7 @@ dist-version: GIT-VERSION-FILE
218
@sed 's|^GITGUI_VERSION=||' <GIT-VERSION-FILE >$(TARDIR)/version
219
220
clean::
218
- $(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg $(PO_TEMPLATE)
221
+ $(RM_RF) $(GITGUI_MAIN) git-gui--askpass lib/tclIndex po/*.msg $(PO_TEMPLATE)
222
$(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
223
ifdef GITGUI_WINDOWS_WRAPPER
224
$(RM_RF) git-gui
generate-script.sh
new
+22
@@ -0,0 +1,22 @@
1
+#!/bin/sh
2
+
3
+set -e
4
+
5
+if test $# -ne 3
6
+then
7
+ echo >&2 "USAGE: $0 <OUTPUT> <INPUT> <GIT-GUI-BUILD-OPTIONS>"
8
+ exit 1
9
+fi
10
+
11
+OUTPUT="$1"
12
+INPUT="$2"
13
+BUILD_OPTIONS="$3"
14
+
15
+. "$BUILD_OPTIONS"
16
+
17
+sed \
18
+ -e "1s|#!.*/sh|#!$SHELL_PATH|" \
19
+ -e "1,3s|^exec wish|exec '$TCLTK_PATH'|" \
20
+ "$INPUT" >"$OUTPUT"
21
+
22
+chmod a+x "$OUTPUT"
git-gui--askpass.sh
renamed
meson.build
+14
-8
@@ -38,14 +38,6 @@ version_file = custom_target(
38
build_always_stale: true,
39
)
40
41
-configure_file(
42
- input: 'git-gui--askpass',
43
- output: 'git-gui--askpass',
44
- copy: true,
45
- install: true,
46
- install_dir: get_option('libexecdir') / 'git-core',
47
-)
48
-
41
gitgui_main = 'git-gui'
42
gitgui_main_install_dir = get_option('libexecdir') / 'git-core'
43
@@ -61,6 +53,20 @@ if target_machine.system() == 'windows'
53
)
54
endif
55
56
+custom_target(
57
+ output: 'git-gui--askpass',
58
+ input: 'git-gui--askpass.sh',
59
+ command: [
60
+ shell,
61
+ meson.current_source_dir() / 'generate-script.sh',
62
+ '@OUTPUT@',
63
+ '@INPUT@',
64
+ meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
65
+ ],
66
+ install: true,
67
+ install_dir: get_option('libexecdir') / 'git-core',
68
+)
69
+
70
custom_target(
71
input: 'git-gui.sh',
72
output: gitgui_main,