summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaMont Jones <lamontjones@google.com>2022-09-01 15:41:12 +0000
committerLaMont Jones <lamontjones@google.com>2022-11-08 19:54:20 +0000
commit7efab539f0fc78aa759000a922c30ac45e84530b (patch)
tree1386caf947c871a861b32657d5f6d371acfda87c
parenta3ff64cae54fca4738f49668c4ee6678969000c3 (diff)
downloadgit-repo-7efab539f0fc78aa759000a922c30ac45e84530b.tar.gz
sync: no garbage collection by default
Adds --auto-gc and --no-auto-gc (default) options to control sync's behavior around calling `git gc`. Bug: b/184882274 Change-Id: I4d6ca3b233d79566f27e876ab2d79f238ebc12a9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/344535 Reviewed-by: Xin Li <delphij@google.com> Tested-by: LaMont Jones <lamontjones@google.com>
-rw-r--r--man/repo-smartsync.19
-rw-r--r--man/repo-sync.112
-rw-r--r--man/repo.16
-rw-r--r--subcmds/sync.py20
4 files changed, 43 insertions, 4 deletions
diff --git a/man/repo-smartsync.1 b/man/repo-smartsync.1
index 8475adf1..c1abbb38 100644
--- a/man/repo-smartsync.1
+++ b/man/repo-smartsync.1
@@ -1,5 +1,5 @@
1.\" DO NOT MODIFY THIS FILE! It was generated by help2man. 1.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
2.TH REPO "1" "August 2022" "repo smartsync" "Repo Manual" 2.TH REPO "1" "November 2022" "repo smartsync" "Repo Manual"
3.SH NAME 3.SH NAME
4repo \- repo smartsync - manual page for repo smartsync 4repo \- repo smartsync - manual page for repo smartsync
5.SH SYNOPSIS 5.SH SYNOPSIS
@@ -105,6 +105,13 @@ delete refs that no longer exist on the remote
105.TP 105.TP
106\fB\-\-no\-prune\fR 106\fB\-\-no\-prune\fR
107do not delete refs that no longer exist on the remote 107do not delete refs that no longer exist on the remote
108.TP
109\fB\-\-auto\-gc\fR
110run garbage collection on all synced projects
111.TP
112\fB\-\-no\-auto\-gc\fR
113do not run garbage collection on any projects
114(default)
108.SS Logging options: 115.SS Logging options:
109.TP 116.TP
110\fB\-v\fR, \fB\-\-verbose\fR 117\fB\-v\fR, \fB\-\-verbose\fR
diff --git a/man/repo-sync.1 b/man/repo-sync.1
index 9cc528dd..f006c03d 100644
--- a/man/repo-sync.1
+++ b/man/repo-sync.1
@@ -1,5 +1,5 @@
1.\" DO NOT MODIFY THIS FILE! It was generated by help2man. 1.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
2.TH REPO "1" "August 2022" "repo sync" "Repo Manual" 2.TH REPO "1" "November 2022" "repo sync" "Repo Manual"
3.SH NAME 3.SH NAME
4repo \- repo sync - manual page for repo sync 4repo \- repo sync - manual page for repo sync
5.SH SYNOPSIS 5.SH SYNOPSIS
@@ -106,6 +106,13 @@ delete refs that no longer exist on the remote
106\fB\-\-no\-prune\fR 106\fB\-\-no\-prune\fR
107do not delete refs that no longer exist on the remote 107do not delete refs that no longer exist on the remote
108.TP 108.TP
109\fB\-\-auto\-gc\fR
110run garbage collection on all synced projects
111.TP
112\fB\-\-no\-auto\-gc\fR
113do not run garbage collection on any projects
114(default)
115.TP
109\fB\-s\fR, \fB\-\-smart\-sync\fR 116\fB\-s\fR, \fB\-\-smart\-sync\fR
110smart sync using manifest from the latest known good 117smart sync using manifest from the latest known good
111build 118build
@@ -200,6 +207,9 @@ to a sha1 revision if the sha1 revision does not already exist locally.
200The \fB\-\-prune\fR option can be used to remove any refs that no longer exist on the 207The \fB\-\-prune\fR option can be used to remove any refs that no longer exist on the
201remote. 208remote.
202.PP 209.PP
210The \fB\-\-auto\-gc\fR option can be used to trigger garbage collection on all projects.
211By default, repo does not run garbage collection.
212.PP
203SSH Connections 213SSH Connections
204.PP 214.PP
205If at least one project remote URL uses an SSH connection (ssh://, git+ssh://, 215If at least one project remote URL uses an SSH connection (ssh://, git+ssh://,
diff --git a/man/repo.1 b/man/repo.1
index bdb705d4..e7368a84 100644
--- a/man/repo.1
+++ b/man/repo.1
@@ -1,5 +1,5 @@
1.\" DO NOT MODIFY THIS FILE! It was generated by help2man. 1.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
2.TH REPO "1" "July 2022" "repo" "Repo Manual" 2.TH REPO "1" "November 2022" "repo" "Repo Manual"
3.SH NAME 3.SH NAME
4repo \- repository management tool built on top of git 4repo \- repository management tool built on top of git
5.SH SYNOPSIS 5.SH SYNOPSIS
@@ -25,6 +25,10 @@ control color usage: auto, always, never
25\fB\-\-trace\fR 25\fB\-\-trace\fR
26trace git command execution (REPO_TRACE=1) 26trace git command execution (REPO_TRACE=1)
27.TP 27.TP
28\fB\-\-trace_to_stderr\fR
29trace outputs go to stderr in addition to
30\&.repo/TRACE_FILE
31.TP
28\fB\-\-trace\-python\fR 32\fB\-\-trace\-python\fR
29trace python command execution 33trace python command execution
30.TP 34.TP
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 83c9ad36..b7542cca 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -200,6 +200,9 @@ exist locally.
200The --prune option can be used to remove any refs that no longer 200The --prune option can be used to remove any refs that no longer
201exist on the remote. 201exist on the remote.
202 202
203The --auto-gc option can be used to trigger garbage collection on all
204projects. By default, repo does not run garbage collection.
205
203# SSH Connections 206# SSH Connections
204 207
205If at least one project remote URL uses an SSH connection (ssh://, 208If at least one project remote URL uses an SSH connection (ssh://,
@@ -309,6 +312,10 @@ later is required to fix a server side protocol bug.
309 help='delete refs that no longer exist on the remote (default)') 312 help='delete refs that no longer exist on the remote (default)')
310 p.add_option('--no-prune', dest='prune', action='store_false', 313 p.add_option('--no-prune', dest='prune', action='store_false',
311 help='do not delete refs that no longer exist on the remote') 314 help='do not delete refs that no longer exist on the remote')
315 p.add_option('--auto-gc', action='store_true',
316 help='run garbage collection on all synced projects')
317 p.add_option('--no-auto-gc', dest='auto_gc', action='store_false',
318 help='do not run garbage collection on any projects (default)')
312 if show_smart: 319 if show_smart:
313 p.add_option('-s', '--smart-sync', 320 p.add_option('-s', '--smart-sync',
314 dest='smart_sync', action='store_true', 321 dest='smart_sync', action='store_true',
@@ -829,7 +836,14 @@ later is required to fix a server side protocol bug.
829 project.config.SetString('gc.pruneExpire', None) 836 project.config.SetString('gc.pruneExpire', None)
830 837
831 def _GCProjects(self, projects, opt, err_event): 838 def _GCProjects(self, projects, opt, err_event):
832 pm = Progress('Garbage collecting', len(projects), delay=False, quiet=opt.quiet) 839 """Perform garbage collection.
840
841 If We are skipping garbage collection (opt.auto_gc not set), we still want
842 to potentially mark objects precious, so that `git gc` does not discard
843 shared objects.
844 """
845 pm = Progress(f'{"" if opt.auto_gc else "NOT "}Garbage collecting',
846 len(projects), delay=False, quiet=opt.quiet)
833 pm.update(inc=0, msg='prescan') 847 pm.update(inc=0, msg='prescan')
834 848
835 tidy_dirs = {} 849 tidy_dirs = {}
@@ -849,6 +863,10 @@ later is required to fix a server side protocol bug.
849 project.bare_git, 863 project.bare_git,
850 ) 864 )
851 865
866 if not opt.auto_gc:
867 pm.end()
868 return
869
852 jobs = opt.jobs 870 jobs = opt.jobs
853 871
854 gc_args = ['--auto'] 872 gc_args = ['--auto']