A platform for community discussion. Free, open, simple.
FIX: Git should not prompt for credentials (#15062)
Dan Ungureanuff7acc9828db
diff --git a/lib/theme_store/git_importer.rb b/lib/theme_store/git_importer.rbindex 15b145d0caa..409a39eca49 100644--- a/lib/theme_store/git_importer.rb+++ b/lib/theme_store/git_importer.rb@@ -87,9 +87,9 @@ class ThemeStore::GitImporterdef import_public!beginif @branch.present?- Discourse::Utils.execute_command("git", "clone", "--single-branch", "-b", @branch, @url, @temp_folder)+ Discourse::Utils.execute_command({ "GIT_TERMINAL_PROMPT" => "0" }, "git", "clone", "--single-branch", "-b", @branch, @url, @temp_folder)else- Discourse::Utils.execute_command("git", "clone", @url, @temp_folder)+ Discourse::Utils.execute_command({ "GIT_TERMINAL_PROMPT" => "0" }, "git", "clone", @url, @temp_folder)endrescue RuntimeErrorraise RemoteTheme::ImportError.new(I18n.t("themes.import_error.git"))diff --git a/spec/components/theme_store/git_importer_spec.rb b/spec/components/theme_store/git_importer_spec.rbindex 46783d5c38f..914ce44ffde 100644--- a/spec/components/theme_store/git_importer_spec.rb+++ b/spec/components/theme_store/git_importer_spec.rb@@ -22,14 +22,14 @@ describe ThemeStore::GitImporter doendit "should import from http url" do- Discourse::Utils.expects(:execute_command).with("git", "clone", url, @temp_folder)+ Discourse::Utils.expects(:execute_command).with({ "GIT_TERMINAL_PROMPT" => "0" }, "git", "clone", url, @temp_folder)importer = ThemeStore::GitImporter.new(url)importer.import!endit "should work with trailing slash url" do- Discourse::Utils.expects(:execute_command).with("git", "clone", url, @temp_folder)+ Discourse::Utils.expects(:execute_command).with({ "GIT_TERMINAL_PROMPT" => "0" }, "git", "clone", url, @temp_folder)importer = ThemeStore::GitImporter.new(trailing_slash_url)importer.import!@@ -45,7 +45,7 @@ describe ThemeStore::GitImporter doendit "should import branch from http url" do- Discourse::Utils.expects(:execute_command).with("git", "clone", "--single-branch", "-b", branch, url, @temp_folder)+ Discourse::Utils.expects(:execute_command).with({ "GIT_TERMINAL_PROMPT" => "0" }, "git", "clone", "--single-branch", "-b", branch, url, @temp_folder)importer = ThemeStore::GitImporter.new(url, branch: branch)importer.import!