From 11bee4b01e4079c4ba402d28fa0526cb91951533 Mon Sep 17 00:00:00 2001 From: LorenzoPegorari Date: Sat, 18 Apr 2026 16:16:54 +0200 Subject: [PATCH 1/6] pack-write: add explanation to promisor file content In the entire codebase there is no explanation as to why the ".promisor" files may contain the ref names (and their associated hashes) that were fetched at the time the corresponding packfile was downloaded. As explained in the log message of commit 5374a290 (fetch-pack: write fetched refs to .promisor, 2019-10-14), where this loop originally came from, these ref names (and associated hashes) are not used for anything in the production, but are solely there to help debugging. Explain this in a new comment. Helped-by: Junio C Hamano Signed-off-by: LorenzoPegorari Signed-off-by: Junio C Hamano --- pack-write.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pack-write.c b/pack-write.c index 83eaf88541..b8ab9510ff 100644 --- a/pack-write.c +++ b/pack-write.c @@ -603,6 +603,15 @@ void write_promisor_file(const char *promisor_name, struct ref **sought, int nr_ int i, err; FILE *output = xfopen(promisor_name, "w"); + /* + * Write in the .promisor file the ref names and associated hashes, + * obtained by fetch-pack, at the point of generation of the + * corresponding packfile. These pieces of info are only used to make + * it easier to debug issues with partial clones, as we can identify + * what refs (and their associated hashes) were fetched at the time + * the packfile was downloaded, and if necessary, compare those hashes + * against what the promisor remote reports now. + */ for (i = 0; i < nr_sought; i++) fprintf(output, "%s %s\n", oid_to_hex(&sought[i]->old_oid), sought[i]->name); From 4f51bcf370f67738b6115b6835c23b97c118545b Mon Sep 17 00:00:00 2001 From: LorenzoPegorari Date: Sat, 18 Apr 2026 16:17:01 +0200 Subject: [PATCH 2/6] repack-promisor add helper to fill promisor file after repack A ".promisor" file may contain ref names (and their associated hashes) that were fetched at the time the corresponding packfile was downloaded. This information is used for debugging reasons. This information is stored as lines structured like this: " ". Create a `write_promisor_file_after_repack()` helper function that allows this debugging info to not be lost after a `repack`, by copying it inside a new ".promisor" file. The function logic is the following: * Take all ".promisor" files contained inside the given `repo`. * Ignore those whose name is contained inside the given `strset not_repacked_names`, which basically acts as a "promisor ignorelist" (intended to be used for packfiles that have not been repacked). * Read each line of the remaining ".promisor" files, which can be: * " " if the ".promisor" file was never repacked. If so, add the time (in Unix time) at which the ".promisor" file was last modified