From 4510be51c1e4852258dd97fb043a250a6e3abfc7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 27 Feb 2021 13:06:27 -0500 Subject: git_command: pass GIT_DIR on Windows with / When using Git under Windows, it seems that Git doesn't always parse GIT_DIR correctly when it uses the Windows \ form, but does when it uses / only. For example, when using worktrees: $ GIT_DIR='C:\Users\vapier\Desktop\repo\breakpad\tools\test\.git' git worktree list fatal: not a git repository: ..\..\.repo\worktrees\linux-syscall-support.git\worktrees\test $ GIT_DIR='C:/Users/vapier/Desktop/repo/breakpad/tools/test/.git' git worktree list C:/Users/vapier/Desktop/repo/breakpad/.repo/worktrees/linux-syscall-support.git fd00dbbd0c06 (detached HEAD) ..\..\..\..\..\src\src\third_party\lss\.git fd00dbbd0c06 (detached HEAD) ..\..\..\..\..\tools\test\.git fd00dbbd0c06 (detached HEAD) Change-Id: I666c03ae845ecb55d7f9800731ea6987d3e7f401 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/298622 Reviewed-by: Michael Mortensen Tested-by: Mike Frysinger --- git_command.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'git_command.py') diff --git a/git_command.py b/git_command.py index 8bd4e67e..d06fc77c 100644 --- a/git_command.py +++ b/git_command.py @@ -285,6 +285,9 @@ class GitCommand(object): command = [GIT] if bare: if gitdir: + # Git on Windows wants its paths only using / for reliability. + if platform_utils.isWindows(): + gitdir = gitdir.replace('\\', '/') env[GIT_DIR] = gitdir cwd = None command.append(cmdv[0]) -- cgit v1.2.3-54-g00ecf