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 <rtenneti@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
diff --git a/git_superproject.py b/git_superproject.py
index 3168d9f..62f2d52 100644
--- a/git_superproject.py
+++ b/git_superproject.py
@@ -26,7 +26,7 @@
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 @@
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]