git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk - convert gitk-path to Windows if on Cygwin

From
Mark Levedahl <mlevedahl@gmail.com>
Date
Jun 15, 2008, 00:33 UTC
Message-ID
<1213490013-908-1-git-send-email-mlevedahl@gmail.com>

Cygwin does not have a recent Tcl release (it is stuck at 8.4.1), and there is small chance this will change soon. The only way Cygwin users can have a more recent Tcl/Tk is to use a pure Windows release. However, these do not understand POSIX paths as used in Cygwin. This really only matters for finding the gitk script itself, all other arguments are interpreted by git which is POSIX. This patch modifies gitk to convert the path to the gitk script from POSIX to Windows before execution.

This patch was inspired by a patch submitted long ago by Shawn Pierce.
Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
---
 Makefile |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index e1b6045..742ae5b 100644
--- a/Makefile
+++ b/Makefile
@@ -51,9 +51,15 @@ uninstall::
 clean::
 	$(RM) gitk-wish po/*.msg
 
+OS := $(shell sh -c 'uname -o 2>/dev/null')
+ifeq ($(OS), Cygwin)
+	EXECLINE = argv0=`cygpath --windows --absolute "$$0"`; \\\nexec $(TCLTK_PATH_SQ) "$$argv0" -- "$$@"
+else
+	EXECLINE = exec $(TCLTK_PATH_SQ) "$$0" -- "$$@"
+endif
 gitk-wish: gitk
 	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
+	sed -e '1,3s|^exec .*|$(EXECLINE)|' <gitk >$@+ && \
 	chmod +x $@+ && \
 	mv -f $@+ $@
 
-- 
1.5.6.rc2.65.gcb6b9
Message 1 of 1 in “gitk - convert gitk-path to Windows if on Cygwin”
  1. gitk - convert gitk-path to Windows if on CygwinMark Levedahl, Jun 15, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.