Skip to contentSkip to conversation

git-sh-setup: work around Cygwin path handling gotchas

PATCH New Steven Penny 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-sh-setup: work around Cygwin path handling gotchas

On Cygwin, tools built for Cygwin can take both Windows-style paths (e.g. C:/dir/file.txt or C:\dir\file.txt) and Cygwin-style paths (e.g. /cygdrive/c/dir/file.txt), but Windows-native tools can only take Windows-style paths. Because the paths that are relative to $GIT_DIR, e.g. the name of the insn sheet file of the "rebase -i" command, are given to the programs with $GIT_DIR prefixed, and $GIT_DIR in turn is computed by calling "pwd", wrap "pwd" to call "cygpath -m" to give a Windows-style path, in a way similar to how mingw does this.

---
 git-sh-setup.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
git-sh-setup.sh +5 -0
index 7b3ae75..07f54c1 100644
@@ -260,6 +260,11 @@ case $(uname -s) in
 		return 1
 	}
 	;;
+*CYGWIN*)
+	pwd () {
+		cygpath -m "$PWD"
+	}
+	;;
 *)
 	is_absolute_path () {
 		case "$1" in
Signature · 1 line
1.7.9