diff --git a/common/lib/dependabot/workspace/git.rb b/common/lib/dependabot/workspace/git.rb index 98114e4f011..58a128454df 100644 --- a/common/lib/dependabot/workspace/git.rb +++ b/common/lib/dependabot/workspace/git.rb @@ -133,7 +133,7 @@ def stash(memo = nil) sig { params(memo: T.nilable(String)).returns([String, String]) } def commit(memo = nil) - run_shell_command("git add #{path}") + run_shell_command(%(git add "#{path}"), allow_unsafe_shell_command: true) diff = run_shell_command("git diff --cached .") msg = memo || "workspace change" diff --git a/common/spec/dependabot/workspace/git_spec.rb b/common/spec/dependabot/workspace/git_spec.rb index 3388bc9d4e6..b4428cb0f17 100644 --- a/common/spec/dependabot/workspace/git_spec.rb +++ b/common/spec/dependabot/workspace/git_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Dependabot::Workspace::Git do subject(:workspace) { described_class.new(repo_contents_path) } - let(:repo_contents_path) { build_tmp_repo("simple", tmp_dir_path: Dir.tmpdir) } + let(:repo_contents_path) { build_tmp_repo("simple", tmp_dir_path: File.join(Dir.tmpdir, "with space")) } around do |example| Dir.chdir(repo_contents_path) { example.run }