Skip to content

Commit

Permalink
Use the -z option to avoid extra quotes in git's output.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kentzo committed Aug 14, 2018
1 parent 645c30a commit b2ce257
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions git_archive_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,11 @@ def walk_git_files(self, repo_path=''):
"""
repo_abspath = path.join(self.main_repo_abspath, repo_path)
repo_file_paths = self.run_git_shell(
'git ls-files --cached --full-name --no-empty-directory',
'git ls-files -z --cached --full-name --no-empty-directory',
repo_abspath
).splitlines()
).split('\0')[:-1]

for repo_file_path in repo_file_paths:
# Git quotes output if it contains non-ASCII or otherwise problematic characters as ".
if repo_file_path.startswith('"') and repo_file_path.endswith('"'):
repo_file_path = repo_file_path[1:-1]

repo_file_abspath = path.join(repo_abspath, repo_file_path) # absolute file path
main_repo_file_path = path.join(repo_path, repo_file_path) # file path relative to the main repo

Expand Down

0 comments on commit b2ce257

Please sign in to comment.