Skip to content

Commit f8ea49f

Browse files
committed
merge-ort: prevent the_repository from coming back
There are two things preventing us from removing our usage of USE_THE_REPOSITORY_VARIABLE: one necessary use of the_repository in prefetch_for_content_merges(), and the use of DEFAULT_ABBREV. We have removed all other uses of the_repository in merge-ort before (multiple times), but without removing that definition, they keep coming back. Define the_repository to make it a compilation error so that they don't come back any more, with a special carve-out for prefetch_for_content_merges(). Signed-off-by: Elijah Newren <newren@gmail.com>
1 parent c0c7600 commit f8ea49f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

merge-ort.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@
5353
#include "unpack-trees.h"
5454
#include "xdiff-interface.h"
5555

56+
/*
57+
* We technically need USE_THE_REPOSITORY_VARIABLE above for two special
58+
* cases, but do NOT want more uses of the_repository. Prevent others
59+
* from returning.
60+
*
61+
* opt->repo is available; use it instead.
62+
*/
63+
#define the_repository DO_NOT_USE_THE_REPOSITORY
64+
5665
/*
5766
* We have many arrays of size 3. Whenever we have such an array, the
5867
* indices refer to one of the sides of the three-way merge. This is so
@@ -4433,6 +4442,12 @@ static int process_entry(struct merge_options *opt,
44334442
return 0;
44344443
}
44354444

4445+
/*
4446+
* prefetch_for_content_merges() is the one special case that needs
4447+
* the_repository (though even it should only use it exactly 1 time)...
4448+
*/
4449+
#undef the_repository
4450+
44364451
static void prefetch_for_content_merges(struct merge_options *opt,
44374452
struct string_list *plist)
44384453
{
@@ -4481,6 +4496,9 @@ static void prefetch_for_content_merges(struct merge_options *opt,
44814496
oid_array_clear(&to_fetch);
44824497
}
44834498

4499+
/* See prior comments about the_repository; use opt->repo instead. */
4500+
#define the_repository DO_NOT_USE_THE_REPOSITORY
4501+
44844502
static int process_entries(struct merge_options *opt,
44854503
struct object_id *result_oid)
44864504
{

0 commit comments

Comments
 (0)