From 2b316cf9bccc3608b439ddc69039377686350784 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 19 Jan 2023 11:13:33 +0100 Subject: 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. --- test/buildtool/file_system/git_repo.test.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'test/buildtool/file_system/git_repo.test.cpp') 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); -- cgit v1.2.3