File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242
4343ON_WINDOWS = sys .platform == 'win32'
4444
45+ def normalize_path (path ):
46+ if ON_WINDOWS and path and path [0 ] == '/' :
47+ return execute (['cygpath' , '-m' , path ])
48+
49+ return path
50+
4551###############################################################################
4652# Setup of 3rd party libs
4753###############################################################################
6167
6268def get_git_dir ():
6369 toplevel_dir = execute (['git' , 'rev-parse' , '--show-toplevel' ])
64- if ON_WINDOWS and toplevel_dir and toplevel_dir [0 ] == '/' :
65- toplevel_dir = execute (['cygpath' , '-m' , toplevel_dir ])
70+ toplevel_dir = normalize_path (toplevel_dir )
6671
6772 if toplevel_dir is not None \
6873 and os .path .isfile (os .path .join (toplevel_dir , '.git' )):
@@ -77,7 +82,8 @@ def get_git_dir():
7782 if inside_worktree == 'true' or Git ().version_info [:3 ] < (2 , 5 , 0 ):
7883 return toplevel_dir
7984 else :
80- return execute (['git' , 'rev-parse' , '--git-common-dir' ])
85+ common_dir = execute (['git' , 'rev-parse' , '--git-common-dir' ])
86+ return normalize_path (common_dir )
8187
8288 return toplevel_dir
8389
You can’t perform that action at this time.
0 commit comments