From 0840fdf0dd451d2f4a667a476f46ece4d0d4df55 Mon Sep 17 00:00:00 2001 From: David Stosik Date: Fri, 4 Oct 2024 22:03:46 +0900 Subject: [PATCH] Support spaces in git repository path See https://github.com/basecamp/kamal/issues/1036 --- lib/kamal/commands/builder/clone.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/kamal/commands/builder/clone.rb b/lib/kamal/commands/builder/clone.rb index 17d9c931..7345ba14 100644 --- a/lib/kamal/commands/builder/clone.rb +++ b/lib/kamal/commands/builder/clone.rb @@ -6,12 +6,12 @@ module Kamal::Commands::Builder::Clone end def clone - git :clone, Kamal::Git.root, "--recurse-submodules", path: clone_directory + git :clone, escaped_root, "--recurse-submodules", path: clone_directory end def clone_reset_steps [ - git(:remote, "set-url", :origin, Kamal::Git.root, path: build_directory), + git(:remote, "set-url", :origin, escaped_root, path: build_directory), git(:fetch, :origin, path: build_directory), git(:reset, "--hard", Kamal::Git.revision, path: build_directory), git(:clean, "-fdx", path: build_directory), @@ -26,4 +26,8 @@ module Kamal::Commands::Builder::Clone def clone_revision git :"rev-parse", :HEAD, path: build_directory end + + def escaped_root + Kamal::Git.root.shellescape + end end