Skip to content

Avoid the_repository in merge-ort and replay#2048

Open
newren wants to merge 5 commits intogitgitgadget:masterfrom
newren:avoid_the_repository
Open

Avoid the_repository in merge-ort and replay#2048
newren wants to merge 5 commits intogitgitgadget:masterfrom
newren:avoid_the_repository

Conversation

@newren
Copy link

@newren newren commented Feb 18, 2026

Remove explicit uses of the_repository and the_hash_algo from merge-ort, and since this has now been done multiple times for both merge-ort and replay, implement a small measure to prevent them from returning to either merge-ort or replay.

See https://lore.kernel.org/git/CABPp-BH7E1Bh2g0vR3T4NEsv34DvFQPzMuJSsqtOAaWY-fFCxg@mail.gmail.com/ and https://lore.kernel.org/git/CABPp-BFuwvqiCTCCpoyT6em9_1-qrgPWHWhrufQ3UuZ+Kfkb6A@mail.gmail.com/ for recent discussions on these.

Series overview:
Patches 1-3: Mostly mechanical removal of existing uses
Patches 4-5: Simple hammer to prevent the problem from returning

In order to get rid of a usage of the_repository, we need to know the
value of opt->repo; pass it along to write_tree().  Once we have the
repository, though, we no longer need to pass
opt->repo->hash_algo->rawsz, we can have write_tree() look up that value
itself.

Signed-off-by: Elijah Newren <newren@gmail.com>
We have a perfectly valid repository available and do not need to use
the_repository, except for one location in
prefetch_for_content_merges().

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
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>
Due to the use of DEFAULT_ABBREV, we cannot get rid of our usage of
USE_THE_REPOSITORY_VARIABLE.  We have removed all other uses of
the_repository before, 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.

Signed-off-by: Elijah Newren <newren@gmail.com>
@newren newren force-pushed the avoid_the_repository branch from e2edab9 to d75a71a Compare February 18, 2026 02:37
@newren
Copy link
Author

newren commented Feb 18, 2026

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Feb 18, 2026

Submitted as pull.2048.git.1771406115.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-2048/newren/avoid_the_repository-v1

To fetch this version to local tag pr-2048/newren/avoid_the_repository-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-2048/newren/avoid_the_repository-v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant