Skip to content

A platform for community discussion. Free, open, simple.

DEV: Reinstate --single-branch when cloning themes (#19026)

Daniel Waterworth47709c6d49fb
diff --git a/lib/theme_store/git_importer.rb b/lib/theme_store/git_importer.rb
index 93878b4e21d..63db9b4b821 100644
--- a/lib/theme_store/git_importer.rb
+++ b/lib/theme_store/git_importer.rb
@@ -108,7 +108,7 @@ class ThemeStore::GitImporter
args << "clone"
if @branch.present?
- args.concat(["-b", @branch])
+ args.concat(['--single-branch', "-b", @branch])
end
args.concat([@url, @temp_folder])
diff --git a/spec/lib/theme_store/git_importer_spec.rb b/spec/lib/theme_store/git_importer_spec.rb
index c6905c95751..62d588f9bf5 100644
--- a/spec/lib/theme_store/git_importer_spec.rb
+++ b/spec/lib/theme_store/git_importer_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe ThemeStore::GitImporter do
.expects(:execute_command)
.with(
{ "GIT_TERMINAL_PROMPT" => "0" },
- "git", "-c", "http.followRedirects=false", "-c", "http.curloptResolve=github.com:443:192.0.2.100", "clone", "-b", branch, "https://github.com/example/example.git", @temp_folder, timeout: 20
+ "git", "-c", "http.followRedirects=false", "-c", "http.curloptResolve=github.com:443:192.0.2.100", "clone", "--single-branch", "-b", branch, "https://github.com/example/example.git", @temp_folder, timeout: 20
)
importer = ThemeStore::GitImporter.new(url, branch: branch)
@@ -72,7 +72,7 @@ RSpec.describe ThemeStore::GitImporter do
.expects(:execute_command)
.with(
{ "GIT_SSH_COMMAND" => "ssh -i #{@ssh_folder}/id_rsa -o IdentitiesOnly=yes -o IdentityFile=#{@ssh_folder}/id_rsa -o StrictHostKeyChecking=no" },
- "git", "clone", "-b", branch, "ssh://[email protected]/example/example.git", @temp_folder, timeout: 20
+ "git", "clone", "--single-branch", "-b", branch, "ssh://[email protected]/example/example.git", @temp_folder, timeout: 20
)
importer = ThemeStore::GitImporter.new(ssh_url, private_key: "private_key", branch: branch)