]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: honor TCLTK_PATH in git-gui--askpass
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Thu, 31 Jul 2025 08:06:27 +0000 (01:06 -0700)
committerJohannes Sixt <j6t@kdbg.org>
Thu, 31 Jul 2025 16:42:54 +0000 (18:42 +0200)
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>
.gitignore
Makefile
generate-script.sh [new file with mode: 0755]
git-gui--askpass.sh [moved from git-gui--askpass with 100% similarity]
meson.build

index ba845f3f3a357c82df0d1195b61c465a8cad00f5..5130b4f0189518462c7c387eb97fa2697ea308b6 100644 (file)
@@ -4,4 +4,5 @@ git-gui.tcl
 GIT-GUI-BUILD-OPTIONS
 GIT-VERSION-FILE
 git-gui
+git-gui--askpass
 lib/tclIndex
index 2ac5f442f499e2dc3c8a9c1a7df9fe84f275db81..2cd160b057552255c2560f1cdf078a733a905f28 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -173,10 +173,13 @@ GIT-GUI-BUILD-OPTIONS: FORCE
        @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
        @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
 
+git-gui--askpass: git-gui--askpass.sh GIT-GUI-BUILD-OPTIONS generate-script.sh
+       $(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS
+
 ifdef GITGUI_WINDOWS_WRAPPER
 all:: git-gui
 endif
-all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES)
+all:: $(GITGUI_MAIN) git-gui--askpass lib/tclIndex $(ALL_MSGFILES)
 
 install: all
        $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
@@ -215,7 +218,7 @@ dist-version: GIT-VERSION-FILE
        @sed 's|^GITGUI_VERSION=||' <GIT-VERSION-FILE  >$(TARDIR)/version
 
 clean::
-       $(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg $(PO_TEMPLATE)
+       $(RM_RF) $(GITGUI_MAIN) git-gui--askpass lib/tclIndex po/*.msg $(PO_TEMPLATE)
        $(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
 ifdef GITGUI_WINDOWS_WRAPPER
        $(RM_RF) git-gui
diff --git a/generate-script.sh b/generate-script.sh
new file mode 100755 (executable)
index 0000000..0dd2da9
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+if test $# -ne 3
+then
+       echo >&2 "USAGE: $0 <OUTPUT> <INPUT> <GIT-GUI-BUILD-OPTIONS>"
+       exit 1
+fi
+
+OUTPUT="$1"
+INPUT="$2"
+BUILD_OPTIONS="$3"
+
+. "$BUILD_OPTIONS"
+
+sed \
+       -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+       -e "1,3s|^exec wish|exec '$TCLTK_PATH'|" \
+       "$INPUT" >"$OUTPUT"
+
+chmod a+x "$OUTPUT"
similarity index 100%
rename from git-gui--askpass
rename to git-gui--askpass.sh
index 1cedc823dec1f09d5104a0a2d71b1e346c2f4776..320ba09ecfeb32188dfbce718d288c2bca0a5013 100644 (file)
@@ -38,14 +38,6 @@ version_file = custom_target(
   build_always_stale: true,
 )
 
-configure_file(
-  input: 'git-gui--askpass',
-  output: 'git-gui--askpass',
-  copy: true,
-  install: true,
-  install_dir: get_option('libexecdir') / 'git-core',
-)
-
 gitgui_main = 'git-gui'
 gitgui_main_install_dir = get_option('libexecdir') / 'git-core'
 
@@ -61,6 +53,20 @@ if target_machine.system() == 'windows'
   )
 endif
 
+custom_target(
+  output: 'git-gui--askpass',
+  input: 'git-gui--askpass.sh',
+  command: [
+    shell,
+    meson.current_source_dir() / 'generate-script.sh',
+    '@OUTPUT@',
+    '@INPUT@',
+    meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
+  ],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
+
 custom_target(
   input: 'git-gui.sh',
   output: gitgui_main,