mirror of
https://git.codelinaro.org/clo/tools/repo.git
synced 2025-06-05 18:10:13 +08:00
Sync: Add option to prune refs during sync
By passing --prune to the sync command, the --prune option is given to the `git fetch`, causing refs that no longer exist on the remote to be removed. Change-Id: I3cedacce14276d96ac2d5aabf2d07fd05e92bc02
This commit is contained in:
11
project.py
11
project.py
@ -1110,7 +1110,8 @@ class Project(object):
|
||||
clone_bundle=True,
|
||||
no_tags=False,
|
||||
archive=False,
|
||||
optimized_fetch=False):
|
||||
optimized_fetch=False,
|
||||
prune=False):
|
||||
"""Perform only the network IO portion of the sync process.
|
||||
Local working directory/branch state is not affected.
|
||||
"""
|
||||
@ -1181,7 +1182,7 @@ class Project(object):
|
||||
if (need_to_fetch
|
||||
and not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir,
|
||||
current_branch_only=current_branch_only,
|
||||
no_tags=no_tags)):
|
||||
no_tags=no_tags, prune=prune)):
|
||||
return False
|
||||
|
||||
if self.worktree:
|
||||
@ -1795,7 +1796,8 @@ class Project(object):
|
||||
initial=False,
|
||||
quiet=False,
|
||||
alt_dir=None,
|
||||
no_tags=False):
|
||||
no_tags=False,
|
||||
prune=False):
|
||||
|
||||
is_sha1 = False
|
||||
tag_name = None
|
||||
@ -1908,6 +1910,9 @@ class Project(object):
|
||||
else:
|
||||
cmd.append('--tags')
|
||||
|
||||
if prune:
|
||||
cmd.append('--prune')
|
||||
|
||||
spec = []
|
||||
if not current_branch_only:
|
||||
# Fetch whole repo
|
||||
|
Reference in New Issue
Block a user