Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c2502e

Browse files
committed
Fix problem with submodules on Windows
On Windows, `repo.create_submodule(...)` failed because git didn't recognize the worktree path set in `.git/modules/sub/config` (`fatal: bad config file line 6 in ./config`). This commit makes `_write_git_file_and_module_config` convert the worktree path to the linux format (forward slashes) which git recognizes.
1 parent be81304 commit 1c2502e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git/objects/submodule/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ def _write_git_file_and_module_config(cls, working_tree_dir, module_abspath):
293293
fp.close()
294294

295295
writer = GitConfigParser(os.path.join(module_abspath, 'config'), read_only=False, merge_includes=False)
296-
writer.set_value('core', 'worktree', os.path.relpath(working_tree_dir, start=module_abspath))
296+
writer.set_value('core', 'worktree',
297+
to_native_path_linux(os.path.relpath(working_tree_dir, start=module_abspath)))
297298
writer.release()
298299

299300
#{ Edit Interface

0 commit comments

Comments
 (0)