All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
To: git@vger.kernel.org
Cc: "Johannes Sixt" <j6t@kdbg.org>,
	"Mark Levedahl" <mlevedahl@gmail.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Patrick Steinhardt" <ps@pks.im>,
	"Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Subject: [PATCH 4/5] git-gui: honor TCLTK_PATH in git-gui--askpass
Date: Wed, 30 Jul 2025 09:40:51 -0700	[thread overview]
Message-ID: <20250730164052.15371-5-carenas@gmail.com> (raw)
In-Reply-To: <20250730164052.15371-1-carenas@gmail.com>

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>
---
 .gitignore                              |  1 +
 Makefile                                |  9 ++++++---
 generate-script.sh                      | 22 ++++++++++++++++++++++
 git-gui--askpass => git-gui--askpass.sh |  0
 meson.build                             | 22 ++++++++++++++--------
 5 files changed, 43 insertions(+), 11 deletions(-)
 create mode 100755 generate-script.sh
 rename git-gui--askpass => git-gui--askpass.sh (100%)

diff --git a/.gitignore b/.gitignore
index ba845f3..5130b4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@ git-gui.tcl
 GIT-GUI-BUILD-OPTIONS
 GIT-VERSION-FILE
 git-gui
+git-gui--askpass
 lib/tclIndex
diff --git a/Makefile b/Makefile
index 2ac5f44..b2d7ffb 100644
--- 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
+all:: git-gui git-gui--askpass
 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
index 0000000..0dd2da9
--- /dev/null
+++ b/generate-script.sh
@@ -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"
diff --git a/git-gui--askpass b/git-gui--askpass.sh
similarity index 100%
rename from git-gui--askpass
rename to git-gui--askpass.sh
diff --git a/meson.build b/meson.build
index 1cedc82..320ba09 100644
--- a/meson.build
+++ b/meson.build
@@ -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,
-- 
2.50.1.475.g795bb014d8


  parent reply	other threads:[~2025-07-30 16:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 16:40 [PATCH 0/5] git-gui: workaround deprecation of Tcl/TK 8.5 in macOS Carlo Marcelo Arenas Belón
2025-07-30 16:40 ` [PATCH 1/5] git-gui: remove uname_O in Makefile Carlo Marcelo Arenas Belón
2025-07-30 20:07   ` Junio C Hamano
2025-07-30 16:40 ` [PATCH 2/5] git-gui: fix dependency of GITGUI_MAIN on generator Carlo Marcelo Arenas Belón
2025-07-30 16:40 ` [PATCH 3/5] git-gui: retire Git Gui.app Carlo Marcelo Arenas Belón
2025-07-30 16:40 ` Carlo Marcelo Arenas Belón [this message]
2025-07-30 19:02   ` [PATCH 4/5] git-gui: honor TCLTK_PATH in git-gui--askpass Johannes Sixt
2025-07-31 10:42     ` Patrick Steinhardt
2025-07-30 16:40 ` [PATCH 5/5] git-gui: ensure own version of git-gui--askpass is used Carlo Marcelo Arenas Belón
2025-07-30 19:04   ` Johannes Sixt
2025-07-30 21:19     ` Mark Levedahl
2025-07-30 19:09 ` [PATCH 0/5] git-gui: workaround deprecation of Tcl/TK 8.5 in macOS Johannes Sixt
2025-07-30 23:54   ` Carlo Arenas
2025-07-31 10:46     ` Patrick Steinhardt
2025-07-30 20:06 ` Junio C Hamano
2025-07-30 20:06 ` Junio C Hamano
2025-07-30 20:51   ` Carlo Arenas
2025-07-31  0:04     ` Junio C Hamano
2025-07-31  8:06 ` [PATCH v2 0/5] git-gui: workaround deprecation of Tcl/Tk " Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 1/5] git-gui: remove uname_O in Makefile Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 2/5] git-gui: fix dependency of GITGUI_MAIN on generator Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 3/5] git-gui: retire Git Gui.app Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 4/5] git-gui: honor TCLTK_PATH in git-gui--askpass Carlo Marcelo Arenas Belón
2025-07-31  8:06   ` [PATCH v2 5/5] git-gui: ensure own version of git-gui--askpass is used Carlo Marcelo Arenas Belón
2025-07-31 17:47     ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250730164052.15371-5-carenas@gmail.com \
    --to=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=mlevedahl@gmail.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.