Skip to content

Commit

Permalink
Normalizes path for git and git submodules
Browse files Browse the repository at this point in the history
`_git_ls_files()` returns file paths with forward slashes. For files
in submodules, add_prefix_to_each() is called to prefix all the
submodule files with the relative path to the project root. On Windows,
the relative path contains backslashes. Since not every file in the
project is in a submodule, the combined list of files ended up with
some files that use forward slashes and others that use backslashes.

For project structures where the submodules share a path segment with
the project source, this caused `add_directories()` to create duplicate
directory entries in the list of files. The duplicate entries would
result in a traceback with a WindowsError when `os.mkdir()` was called
to create the same directory a second time.

See mgedmin#61 for more details.

This commit replaces the backslashes with forward slashes in the
relative path, eliminating the duplicate directory entries.
  • Loading branch information
lorengordon committed Aug 26, 2016
1 parent 2a40aa8 commit 005dfac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion check_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def get_versioned_files(cls):
files = cls._git_ls_files()
submodules = cls._list_submodules()
for subdir in submodules:
subdir = os.path.relpath(subdir)
subdir = os.path.relpath(subdir).replace(os.path.sep, '/')
files += add_prefix_to_each(subdir, cls._git_ls_files(subdir))
return add_directories(files)

Expand Down

0 comments on commit 005dfac

Please sign in to comment.