From: Toon Claes Date: Fri, 28 Aug 2026 14:53:47 GMT Subject: Re: [PATCH 8/8] odb/source: remove the ability to write alternates Message-ID: <871pbiuwhw.fsf@emacs.iotcl.com> In-Reply-To: <20260825-pks-odb-write-alternates-at-creation-time-v1-8-911513ba95c3@pks.im> Patrick Steinhardt writes: > There are no users of `odb_source_write_alternates()` in our tree > anymore. Remove that function and its supporting infrastructure. > > Signed-off-by: Patrick Steinhardt > --- > odb.c | 9 --------- > odb.h | 7 ------- > odb/source-files.c | 55 --------------------------------------------------- > odb/source-inmemory.c | 7 ------- > odb/source-loose.c | 7 ------- > odb/source-packed.c | 7 ------- > odb/source.h | 26 ------------------------ > 7 files changed, 118 deletions(-) > > diff --git a/odb.c b/odb.c > index 67d98d64fc..b531cf8fb3 100644 > --- a/odb.c > +++ b/odb.c > @@ -239,15 +239,6 @@ static struct odb_source *odb_add_alternate_recursively(struct object_database * > return alternate; > } > > -void odb_add_to_alternates_file(struct object_database *odb, > - const char *dir) > -{ > - int ret = odb_source_write_alternate(odb->sources, dir); > - if (ret < 0) > - die(NULL); > - odb_add_alternate_recursively(odb, dir, 0); > -} > - > struct odb_source *odb_add_to_alternates_memory(struct object_database *odb, > const char *dir) > { > diff --git a/odb.h b/odb.h > index b9e0db56ec..2d002461f8 100644 > --- a/odb.h > +++ b/odb.h > @@ -270,13 +270,6 @@ int odb_mkstemp(struct object_database *odb, > */ > int odb_has_alternates(struct object_database *odb); > > -/* > - * Add the directory to the on-disk alternates file; the new entry will also > - * take effect in the current process. > - */ > -void odb_add_to_alternates_file(struct object_database *odb, > - const char *dir); > - > /* > * Add the directory to the in-memory list of alternate sources (along with any > * recursive alternates it points to), but do not modify the on-disk alternates > diff --git a/odb/source-files.c b/odb/source-files.c > index 5e77b21d9f..feef9e169a 100644 > --- a/odb/source-files.c > +++ b/odb/source-files.c > @@ -4,7 +4,6 @@ > #include "chdir-notify.h" > #include "config.h" > #include "gettext.h" > -#include "lockfile.h" > #include "object-file.h" > #include "odb.h" > #include "odb/source.h" > @@ -303,59 +302,6 @@ static int odb_source_files_read_alternates(struct odb_source *source, > return 0; > } > > -static int odb_source_files_write_alternate(struct odb_source *source, > - const char *alternate) > -{ > - struct lock_file lock = LOCK_INIT; > - char *path = xstrfmt("%s/%s", source->path, "info/alternates"); > - FILE *in, *out; > - int found = 0; > - int ret; > - > - repo_hold_lock_file_for_update(source->odb->repo, &lock, path, > - LOCK_DIE_ON_ERROR); Why is the new implementation not using a lockfile? -- Laters, Toon