Skip to content

Commit 0e3233b

Browse files
carenasj6t
authored andcommitted
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 <[email protected]> Signed-off-by: Johannes Sixt <[email protected]>
1 parent df41037 commit 0e3233b

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ git-gui.tcl
44
GIT-GUI-BUILD-OPTIONS
55
GIT-VERSION-FILE
66
git-gui
7+
git-gui--askpass
78
lib/tclIndex

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,13 @@ GIT-GUI-BUILD-OPTIONS: FORCE
173173
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
174174
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
175175

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+
176179
ifdef GITGUI_WINDOWS_WRAPPER
177180
all:: git-gui
178181
endif
179-
all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
182+
all:: $(GITGUI_MAIN) git-gui--askpass lib/tclIndex $(ALL_MSGFILES)
180183

181184
install: all
182185
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
@@ -215,7 +218,7 @@ dist-version: GIT-VERSION-FILE
215218
@sed 's|^GITGUI_VERSION=||' <GIT-VERSION-FILE >$(TARDIR)/version
216219

217220
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)
219222
$(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
220223
ifdef GITGUI_WINDOWS_WRAPPER
221224
$(RM_RF) git-gui

generate-script.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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"
File renamed without changes.

meson.build

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ version_file = custom_target(
3838
build_always_stale: true,
3939
)
4040

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-
4941
gitgui_main = 'git-gui'
5042
gitgui_main_install_dir = get_option('libexecdir') / 'git-core'
5143

@@ -61,6 +53,20 @@ if target_machine.system() == 'windows'
6153
)
6254
endif
6355

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+
6470
custom_target(
6571
input: 'git-gui.sh',
6672
output: gitgui_main,

0 commit comments

Comments
 (0)