From: Josh Durgin Date: Tue, 2 Feb 2021 19:48:47 +0000 (-0500) Subject: repo_utils: clone entire branch if commit is specified X-Git-Tag: 1.1.0~15^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4b16be27715adb1e2f3ba744ad21320f06d4a6e0;p=teuthology.git 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 --- 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])