Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit ceae167

Browse files
committed
Quote git_dir when used in git command execution
This prevents exceptions (and possibly worse) when attempting to execute git against repositories whose path contains a space. Note that this doesn't try to protect against stranger cases, like directory names that contain double-quotes, but I'm not familiar with all the special characters that would need to be escaped here.
1 parent fa5298a commit ceae167

File tree

1 file changed

+1
-1
lines changed
  • lib/code_climate/test_reporter

1 file changed

+1
-1
lines changed

lib/code_climate/test_reporter/git.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def branch_from_git
4545
end
4646

4747
def git(command)
48-
`git --git-dir=#{git_dir}/.git #{command}`
48+
`git --git-dir="#{git_dir}"/.git #{command}`
4949
end
5050

5151
def git_dir

0 commit comments

Comments
 (0)