From 4b16be27715adb1e2f3ba744ad21320f06d4a6e0 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 2 Feb 2021 14:48:47 -0500 Subject: [PATCH] repo_utils: clone entire branch if commit is specified If the commit is not the head of the branch, we need more history to be able to check it out. Signed-off-by: Josh Durgin --- teuthology/repo_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/teuthology/repo_utils.py b/teuthology/repo_utils.py index c673fd1eb6..582ff79993 100644 --- a/teuthology/repo_utils.py +++ b/teuthology/repo_utils.py @@ -91,7 +91,7 @@ def enforce_repo_state(repo_url, dest_path, branch, commit=None, remove_on_error repo_reset = os.path.join(dest_path, '.fetched_and_reset') try: if not os.path.isdir(dest_path): - clone_repo(repo_url, dest_path, branch) + clone_repo(repo_url, dest_path, branch, shallow=commit is None) elif not commit and not is_fresh(sentinel): set_remote(dest_path, repo_url) fetch_branch(dest_path, branch) @@ -127,7 +127,7 @@ def clone_repo(repo_url, dest_path, branch, shallow=True): if branch.startswith('refs/'): clone_repo_ref(repo_url, dest_path, branch) return - args = ['git', 'clone'] + args = ['git', 'clone', '--single-branch'] if shallow: args.extend(['--depth', '1']) args.extend(['--branch', branch, repo_url, dest_path]) -- 2.39.5