git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Subject: [PATCH 3/5] refs/files: stop using `the_repository`
Date: Tue, 30 Jul 2024 07:22:56 +0200	[thread overview]
Message-ID: <cd51e9694d20e70b4c95a7ab8aee65e43c69cbe1.1722316795.git.ps@pks.im> (raw)
In-Reply-To: <cover.1722316795.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]

Convert the files ref backend to stop using `the_repository` in favor of
the repo that gets passed in via `struct ref_store`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 refs/files-backend.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/refs/files-backend.c b/refs/files-backend.c
index 3437c79699..c73f95ecf2 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1,5 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
-
 #include "../git-compat-util.h"
 #include "../copy.h"
 #include "../environment.h"
@@ -248,7 +246,7 @@ static void loose_fill_ref_dir_regular_file(struct files_ref_store *refs,
 
 	if (!refs_resolve_ref_unsafe(&refs->base, refname, RESOLVE_REF_READING,
 				     &oid, &flag)) {
-		oidclr(&oid, the_repository->hash_algo);
+		oidclr(&oid, refs->base.repo->hash_algo);
 		flag |= REF_ISBROKEN;
 	} else if (is_null_oid(&oid)) {
 		/*
@@ -265,7 +263,7 @@ static void loose_fill_ref_dir_regular_file(struct files_ref_store *refs,
 	if (check_refname_format(refname, REFNAME_ALLOW_ONELEVEL)) {
 		if (!refname_is_safe(refname))
 			die("loose refname is dangerous: %s", refname);
-		oidclr(&oid, the_repository->hash_algo);
+		oidclr(&oid, refs->base.repo->hash_algo);
 		flag |= REF_BAD_NAME | REF_ISBROKEN;
 	}
 	add_entry_to_dir(dir, create_ref_entry(refname, &oid, flag));
@@ -1154,7 +1152,7 @@ static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,
 
 	if (!refs_resolve_ref_unsafe(&refs->base, lock->ref_name, 0,
 				     &lock->old_oid, NULL))
-		oidclr(&lock->old_oid, the_repository->hash_algo);
+		oidclr(&lock->old_oid, refs->base.repo->hash_algo);
 	goto out;
 
  error_return:
-- 
2.46.0.rc1.dirty


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2024-07-30  5:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30  5:22 [PATCH 0/5] refs: stop using `the_repository` Patrick Steinhardt
2024-07-30  5:22 ` [PATCH 1/5] " Patrick Steinhardt
2024-07-30  5:22 ` [PATCH 2/5] refs/files: stop using `the_repository` in `parse_loose_ref_contents()` Patrick Steinhardt
2024-07-30  5:22 ` Patrick Steinhardt [this message]
2024-07-30  5:23 ` [PATCH 4/5] refs/packed: stop using `the_repository` Patrick Steinhardt
2024-07-30 11:23   ` Karthik Nayak
2024-07-31  4:59     ` Patrick Steinhardt
2024-07-30  5:23 ` [PATCH 5/5] refs/reftable: " Patrick Steinhardt
2024-07-30 11:26 ` [PATCH 0/5] refs: " Karthik Nayak
2024-07-31  5:01   ` Patrick Steinhardt
2024-07-31  0:55 ` James Liu
2024-07-31  5:06   ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd51e9694d20e70b4c95a7ab8aee65e43c69cbe1.1722316795.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).