From: Brandon Williams <bmwill@xxxxxxxxxx> Signed-off-by: Brandon Williams <bmwill@xxxxxxxxxx> Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- alternates.h | 3 +-- sha1_file.c | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/alternates.h b/alternates.h index b3d8d57ba4..4d5296c83f 100644 --- a/alternates.h +++ b/alternates.h @@ -48,8 +48,7 @@ struct alternate_object_database *alloc_alt_odb(const char *dir); * Add the directory to the on-disk alternates file; the new entry will also * take effect in the current process. */ -#define add_to_alternates_file(r, d) add_to_alternates_file_##r(d) -extern void add_to_alternates_file_the_repository(const char *dir); +extern void add_to_alternates_file(struct repository *r, const char *dir); /* * Add the directory to the in-memory list of alternates (along with any diff --git a/sha1_file.c b/sha1_file.c index 3c39e34c72..8638fae9c4 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -538,10 +538,10 @@ struct alternate_object_database *alloc_alt_odb(const char *dir) return ent; } -void add_to_alternates_file_the_repository(const char *reference) +void add_to_alternates_file(struct repository *r, const char *reference) { struct lock_file lock = LOCK_INIT; - char *alts = git_pathdup("objects/info/alternates"); + char *alts = repo_git_path(r, "objects/info/alternates"); FILE *in, *out; int found = 0; @@ -574,8 +574,8 @@ void add_to_alternates_file_the_repository(const char *reference) fprintf_or_die(out, "%s\n", reference); if (commit_lock_file(&lock)) die_errno("unable to move new alternates file into place"); - if (the_repository->objects.alt_odb.tail) - link_alt_odb_entries(the_repository, reference, + if (r->objects.alt_odb.tail) + link_alt_odb_entries(r, reference, '\n', NULL, 0); } free(alts); -- 2.15.1.433.g936d1b9894.dirty