aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Chang <oliverchang@users.noreply.github.com>2021-03-23 14:17:37 +1100
committerGitHub <noreply@github.com>2021-03-23 14:17:37 +1100
commite8646d25ecd0a93adb8cb3099064a4216529ecf7 (patch)
treeffe27b6b7920f62391af853be98c2210c15f79f3
parent09bdabccd475dece5666c56bb2312781ed2760ed (diff)
downloadoss-fuzz-e8646d25ecd0a93adb8cb3099064a4216529ecf7.tar.gz
Fix bisection when the original checkout is for a single branch. (#5478)
Repos cloned with `--branch BRANCH` will only track that branch, even when we unshallow. If we provide a git SHA from another branch, it will not be recognized. To fix, this, we update the remote tracking config and fetch them. For google/osv#88.
-rw-r--r--infra/bisector.py2
-rw-r--r--infra/repo_manager.py8
2 files changed, 10 insertions, 0 deletions
diff --git a/infra/bisector.py b/infra/bisector.py
index dc4a470d5..1438d0de9 100644
--- a/infra/bisector.py
+++ b/infra/bisector.py
@@ -189,6 +189,8 @@ def _bisect(bisect_type, old_commit, new_commit, test_case_path, fuzz_target,
bisect_repo_manager = repo_manager.RepoManager(
os.path.join(host_src_dir, os.path.basename(repo_path)))
+ bisect_repo_manager.fetch_all_remotes()
+
commit_list = bisect_repo_manager.get_commit_list(new_commit, old_commit)
old_idx = len(commit_list) - 1
diff --git a/infra/repo_manager.py b/infra/repo_manager.py
index a5781b89a..a0b97b3ef 100644
--- a/infra/repo_manager.py
+++ b/infra/repo_manager.py
@@ -127,6 +127,14 @@ class RepoManager:
return out.strip()
+ def fetch_all_remotes(self):
+ """Fetch all remotes for checkouts that track a single branch."""
+ self.git([
+ 'config', 'remote.origin.fetch', '+refs/heads/*:refs/remotes/origin/*'
+ ],
+ check_result=True)
+ self.git(['remote', 'update'], check_result=True)
+
def get_commit_list(self, newest_commit, oldest_commit=None):
"""Gets the list of commits(inclusive) between the old and new commits.