commit 06285208fae857821ae1f92a774f2bc91c71ec7a9f5817693caf26bb5f88fad7 from: Stefan Sperling date: Sun May 3 14:58:01 2026 UTC cleanup: fix redundant pack file removal when repository contains symlinks Add symlinks to the set of traversed object IDs during cleanup. Otherwise, packfiles which contain blobs that are symlinks will always be marked as containing unreferenced objects and 'gotadmin cleanup' will not remove them. This can result in an explosion of redundant packfiles if 'gotadmin cleanup' is run at regular intervals, and if the cleanup -a option is not used. I am unsure how to write a test case for this fix without making additional changes to the cleanup command. The tests run cleanup -a to bypass the mtime staleness safety check. This will never hit the problematic case fixed here. Reproducing the problem would require a test which waits for the (currently) hard-coded interval of 600 seconds before running cleanup. If we added a way to tweak the mtime threshold from tests then we could probably add a test case which covers this issue. Problem found because gothub.org backups were taking much more disk space than expected. ok runxi yu, op@ commit - f3243aa5875dfd29e54bed572bb4f5e040e6a2618b56a4294acc04fbef092405 commit + 06285208fae857821ae1f92a774f2bc91c71ec7a9f5817693caf26bb5f88fad7 blob - 30289592c84fb9ca3032a3606d0e230ee71a5da39c0d8f84eedd44028f9e3807 blob + 2ee8f1e4bb8080b1f1d1c481a3d8dc4cfe9fcff87c3f62b1f1ce8edd7477d357 --- lib/repository_admin.c +++ lib/repository_admin.c @@ -865,8 +865,7 @@ load_tree_entries(struct got_object_id_queue *ids, break; } - if (got_object_tree_entry_is_symlink(e) || - got_object_tree_entry_is_submodule(e) || + if (got_object_tree_entry_is_submodule(e) || got_object_idset_contains(traversed_ids, id)) continue; @@ -882,7 +881,7 @@ load_tree_entries(struct got_object_id_queue *ids, if (err) break; STAILQ_INSERT_TAIL(ids, qid, entry); - } else if (S_ISREG(mode)) { + } else if (S_ISREG(mode) || S_ISLNK(mode)) { /* This blob is referenced. */ err = got_object_idset_add(traversed_ids, id, NULL); if (err)