[PATCH 1/1] gc: refuse to proceed when there are no refs

0 views
Skip to first unread message

Rob Browning

unread,
Mar 5, 2026, 5:20:02 PM (9 days ago) Mar 5
to bup-...@googlegroups.com
For now, when gc finds that the respository has no refs, just stop
under the assumption that either something's wrong, or you can just
create a new repository.

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---

Pushed to main.

lib/bup/gc.py | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/bup/gc.py b/lib/bup/gc.py
index 22c2d64b..8923aac0 100644
--- a/lib/bup/gc.py
+++ b/lib/bup/gc.py
@@ -100,6 +100,8 @@ def find_live_objects(existing_count, cat_pipe, refs=None, *,
oid_exists = idx_list.exists if idx_list else None
approx_live_count = 0
scan_refs = refs if refs else list(git.list_refs())
+ if not scan_refs:
+ raise Exception('no refs; suspicious, refusing to proceed')
ref_n = len(scan_refs)
def progress_msg(ref_i):
return 'scanned %s of %s ref%s (%02.2f%% of all objects)' \
--
2.47.3

Reply all
Reply to author
Forward
0 new messages