bromite-buildtools/images/chr-source/depot_tools.diff

64 lines
2.5 KiB
Diff
Raw Normal View History

2021-06-19 15:16:24 +05:30
diff --git a/gclient_scm.py b/gclient_scm.py
2022-07-15 13:32:47 +05:30
index f58c07a8..c8409726 100644
2021-06-19 15:16:24 +05:30
--- a/gclient_scm.py
+++ b/gclient_scm.py
2022-07-15 13:32:47 +05:30
@@ -1137,31 +1137,29 @@ class GitWrapper(SCMWrapper):
clone_cmd.append(url)
template_dir = None
+ use_fetch = False
2021-06-19 15:16:24 +05:30
+
2022-07-15 13:32:47 +05:30
+ tmp_dir = tempfile.mkdtemp(
+ prefix='_gclient_%s_' % os.path.basename(self.checkout_path),
+ dir=parent_dir)
2021-06-19 15:16:24 +05:30
+
2022-07-15 13:32:47 +05:30
if hasattr(options, 'no_history') and options.no_history:
if gclient_utils.IsGitSha(revision):
- # In the case of a subproject, the pinned sha is not necessarily the
- # head of the remote branch (so we can't just use --depth=N). Instead,
- # we tell git to fetch all the remote objects from SHA..HEAD by means
- # of a template git dir which has a 'shallow' file pointing to the
- # sha.
- template_dir = tempfile.mkdtemp(prefix='_gclient_gittmp_%s' %
- os.path.basename(self.checkout_path),
- dir=parent_dir)
- self._Run(['init', '--bare', template_dir],
- options,
- cwd=self._root_dir)
- with open(os.path.join(template_dir, 'shallow'),
- 'w') as template_file:
- template_file.write(revision)
- clone_cmd.append('--template=' + template_dir)
+ self._Run(['init', tmp_dir], options, cwd=self._root_dir)
2021-06-19 15:16:24 +05:30
+
2022-07-15 13:32:47 +05:30
+ self._Run(['-C', tmp_dir, 'remote', 'add', 'origin', url], options, cwd=self._root_dir)
2021-06-19 15:16:24 +05:30
+
2022-07-15 13:32:47 +05:30
+ clone_cmd = cfg + ['-C', tmp_dir, 'fetch', '--progress']
+ clone_cmd.append('--depth=1')
+ clone_cmd.append(url)
+ clone_cmd.append(revision)
+ use_fetch = True
else:
# Otherwise, we're just interested in the HEAD. Just use --depth.
clone_cmd.append('--depth=1')
- tmp_dir = tempfile.mkdtemp(prefix='_gclient_%s_' %
- os.path.basename(self.checkout_path),
- dir=parent_dir)
2021-06-19 15:16:24 +05:30
- clone_cmd.append(tmp_dir)
+ if use_fetch == False:
+ clone_cmd.append(tmp_dir)
2022-07-15 13:32:47 +05:30
try:
self._Run(clone_cmd,
@@ -1452,6 +1450,9 @@ class GitWrapper(SCMWrapper):
2021-06-19 15:16:24 +05:30
if refspec:
fetch_cmd.append(refspec)
2022-07-15 13:32:47 +05:30
2021-06-19 15:16:24 +05:30
+ if hasattr(options, 'no_history') and options.no_history:
+ fetch_cmd.append('--depth=1')
+
if prune:
fetch_cmd.append('--prune')
if options.verbose: