make gotadmin cleanup pack the repository before cleaning
commit44e1226a2053c76971c5bb2b222acf720453f866
authorStefan Sperling <stsp@stsp.name>
Tue, 21 Jan 2025 15:03:27 +0000 (21 15:03 +0000)
committerThomas Adam <thomas@xteddy.org>
Fri, 24 Jan 2025 22:02:34 +0000 (24 22:02 +0000)
treeb9cec7ff56828b77c98670b900cfea90fbf0ca84
parent794a213ff7f2e0fada025ef53a9b5cfeecf17b94
make gotadmin cleanup pack the repository before cleaning

Our cleanup implementation is only safe to use after everything
referenced has been packed into a single pack file. Otherwise, the
algorithm we use for checking pack redundancy might remove small
packs which contain objects that other objects depend on.

The easy fix for this issue is to have 'gotadmin cleanup' create the
required pack file before cleaning up, making cleanup safe by default.
This happens to be what 'git gc' does as well.

ok jamsek
gotadmin/gotadmin.c
gotd/repo_read.c
include/got_repository_admin.h
lib/got_lib_pack_create.h
lib/pack_create.c
lib/pack_create_io.c
lib/pack_create_privsep.c
lib/repository_admin.c
lib/send.c
regress/cmdline/cleanup.sh
regress/cmdline/common.sh