From e253b43e17de114f1efafa9a3e3929f23115ae99 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Wed, 2 Jun 2021 10:05:54 -0700 Subject: [PATCH] superproject: require git version 2.28.0 or higher. Tested the code with the following commands. $ repo init --use-superproject -u https://android.googlesource.com/platform/manifest + Tested for the wrong git version. $ repo_dev init --use-superproject -u https://android.googlesource.com/platform/manifest WARNING: --use-superproject is experimental and not for general use superproject requires a git version 2.28 or later error: git update of superproject failed $ ./run_tests -v Bug: https://crbug.com/gerrit/14617 Bug: [google internal] b/189846687 Change-Id: I5cd4158ea29b3b3c8c81234f4e818165de346e63 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/308442 Tested-by: Raman Tenneti Reviewed-by: Mike Frysinger --- git_superproject.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git_superproject.py b/git_superproject.py index 3168d9f8..62f2d52f 100644 --- a/git_superproject.py +++ b/git_superproject.py @@ -26,7 +26,7 @@ import hashlib import os import sys -from git_command import GitCommand +from git_command import git_require, GitCommand from git_refs import R_HEADS _SUPERPROJECT_GIT_NAME = 'superproject.git' @@ -120,6 +120,9 @@ class Superproject(object): print('git fetch missing drectory: %s' % self._work_git, file=sys.stderr) return False + if not git_require((2, 28, 0)): + print('superproject requires a git version 2.28 or later', file=sys.stderr) + return False cmd = ['fetch', url, '--depth', '1', '--force', '--no-tags', '--filter', 'blob:none'] if self._branch: cmd += [self._branch + ':' + self._branch]