Skip to content

Commit

Permalink
[downloader] Don't duplicate get-branch curl request
Browse files Browse the repository at this point in the history
  • Loading branch information
kilativ-dotcom committed Oct 10, 2024
1 parent 6da72a1 commit 0e69fc8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ std::string const GitHubConstants::GIT_CLONE = "git clone";
std::string const GitHubConstants::RAW_GITHUB_PREFIX = "https://raw.githubusercontent.com/";
std::string const GitHubConstants::GITHUB_PREFIX = "https://github.com/";
std::string const GitHubConstants::TREE = "tree";
std::string const GitHubConstants::CURL_GET_BRANCH_COMMAND =
"curl -s -H \"Accept: application/vnd.github.v3+json\" https://api.github.com/repos/";
std::string const GitHubConstants::GREP_DEFAULT_BRANCH_COMMAND =
R"( | grep -w "default_branch" | cut -d ":" -f 2 | tr -d '," ')";
std::string const GitHubConstants::GITHUB_DOWNLOAD_FILE_COMMAND_PREFIX =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class GitHubConstants
static std::string const RAW_GITHUB_PREFIX;
static std::string const GITHUB_PREFIX;
static std::string const TREE;
static std::string const CURL_GET_BRANCH_COMMAND;
static std::string const GREP_DEFAULT_BRANCH_COMMAND;
static std::string const GITHUB_DOWNLOAD_FILE_COMMAND_PREFIX;
static std::string const GITHUB_GET_DEFAULT_BRANCH_COMMAND_PREFIX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class DownloaderGit : public Downloader
static std::string GetDefaultBranch(std::string const & username, std::string const & repositoryName)
{
std::stringstream query;
query << GitHubConstants::GITHUB_GET_DEFAULT_BRANCH_COMMAND_PREFIX << GitHubConstants::CURL_GET_BRANCH_COMMAND
<< username << SpecificationConstants::DIRECTORY_DELIMITER << repositoryName
query << GitHubConstants::GITHUB_GET_DEFAULT_BRANCH_COMMAND_PREFIX << username
<< SpecificationConstants::DIRECTORY_DELIMITER << repositoryName
<< GitHubConstants::GREP_DEFAULT_BRANCH_COMMAND;

ScExec exec{{query.str()}};
Expand Down

0 comments on commit 0e69fc8

Please sign in to comment.