summaryrefslogtreecommitdiff
path: root/test/buildtool/file_system/git_repo.test.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-19 11:13:33 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-01-24 15:47:31 +0100
commit2b316cf9bccc3608b439ddc69039377686350784 (patch)
tree2e00926ca30ef55e3ae66c381ea5a0e650173de7 /test/buildtool/file_system/git_repo.test.cpp
parent51130a4ef9bfb4139ffb748d1e0e4f491a442bfd (diff)
downloadjustbuild-2b316cf9bccc3608b439ddc69039377686350784.tar.gz
GitRepo: Remove refspec argument in retrieving commit from remote...
...and use instead the branch name. A valid direct refspec (as those retrieved by a remote_ls call) will always end in the branch name, so checking the last path component ('/'-delimited substring) of a retrieved refspec is enough.
Diffstat (limited to 'test/buildtool/file_system/git_repo.test.cpp')
-rw-r--r--test/buildtool/file_system/git_repo.test.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/test/buildtool/file_system/git_repo.test.cpp b/test/buildtool/file_system/git_repo.test.cpp
index d62ec2f1..23d50f51 100644
--- a/test/buildtool/file_system/git_repo.test.cpp
+++ b/test/buildtool/file_system/git_repo.test.cpp
@@ -224,14 +224,9 @@ TEST_CASE("Single-threaded real repository remote operations", "[git_repo]") {
auto repo_remote_ls_bare = GitRepo::Open(*path_remote_ls_bare);
REQUIRE(repo_remote_ls_bare);
- // get refname of branch
- auto branch_refname =
- repo_remote_ls_bare->GetBranchLocalRefname("master", logger);
- REQUIRE(branch_refname);
- REQUIRE(*branch_refname == "refs/heads/master");
// remote ls
auto remote_commit = repo_remote_ls_bare->GetCommitFromRemote(
- *repo_path, *branch_refname, logger);
+ *repo_path, "master", logger);
REQUIRE(remote_commit);
CHECK(*remote_commit == kRootCommit);
}
@@ -467,7 +462,7 @@ TEST_CASE("Single-threaded fake repository operations", "[git_repo]") {
auto tmp_path_commit_upd = TestUtils::GetRepoPath();
// do remote ls
auto fetched_commit = repo_commit_upd->UpdateCommitViaTmpRepo(
- tmp_path_commit_upd, *repo_path, "refs/heads/master", logger);
+ tmp_path_commit_upd, *repo_path, "master", logger);
REQUIRE(fetched_commit);
CHECK(*fetched_commit == kRootCommit);
@@ -615,7 +610,7 @@ TEST_CASE("Multi-threaded fake repository operations", "[git_repo]") {
target_repo->UpdateCommitViaTmpRepo(
tmp_path_commit_upd,
*remote_repo_path,
- "refs/heads/master",
+ "master",
logger);
REQUIRE(fetched_commit);