Skip to content

Commit df4ec4c

Browse files
committed
git-gui: Avoid hardcoded Windows paths in Cygwin package files
When we are being built by the Cygwin package maintainers we need to embed the POSIX path to our library files and not the Windows path. Embedding the Windows path means all end-users who install our Cygwin package would be required to install Cygwin at the same Windows path as the package maintainer had Cygwin installed to. This requirement is simply not user-friendly and may be infeasible for a large number of our users. We now try to auto-detect if the Tcl/Tk binary we will use at runtime is capable of translating POSIX paths into Windows paths the same way that cygpath does the translations. If the Tcl/Tk binary gives us the same results then it understands the Cygwin path translation process and should be able to read our library files from a POSIX path name. If it does not give us the same answer as cygpath then the Tcl/Tk binary might actually be a native Win32 build (one that is not linked against Cygwin) and thus requires the native Windows path to our library files. We can assume this is not a Cygwin package as the Cygwin maintainers do not currently ship a pure Win32 build of Tcl/Tk. Reported on the git mailing list by Jurko Gospodnetić. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
1 parent 651fbba commit df4ec4c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,17 @@ GITGUI_MACOSXAPP :=
131131

132132
ifeq ($(uname_O),Cygwin)
133133
GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
134-
gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
134+
135+
# Is this a Cygwin Tcl/Tk binary? If so it knows how to do
136+
# POSIX path translation just like cygpath does and we must
137+
# keep libdir in POSIX format so Cygwin packages of git-gui
138+
# work no matter where the user installs them.
139+
#
140+
ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /))
141+
gg_libdir_sed_in := $(gg_libdir)
142+
else
143+
gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
144+
endif
135145
else
136146
ifeq ($(exedir),$(gg_libdir))
137147
GITGUI_RELATIVE := 1

0 commit comments

Comments
 (0)