git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Subject: [PATCH 15/16] refs/files: remove references to `the_hash_algo`
Date: Thu, 16 May 2024 10:05:24 +0200	[thread overview]
Message-ID: <ab0c7937392c3067d56ff43079c91de70d4a19e0.1715836916.git.ps@pks.im> (raw)
In-Reply-To: <cover.1715836916.git.ps@pks.im>

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

Remove references to `the_hash_algo` in favor of the hash algo specified
by the repository associated with the files ref store.

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

diff --git a/refs/files-backend.c b/refs/files-backend.c
index 5294282770..5684f1bfc6 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1822,7 +1822,7 @@ static int write_ref_to_lockfile(struct files_ref_store *refs,
 		}
 	}
 	fd = get_lock_file_fd(&lock->lk);
-	if (write_in_full(fd, oid_to_hex(oid), the_hash_algo->hexsz) < 0 ||
+	if (write_in_full(fd, oid_to_hex(oid), refs->base.repo->hash_algo->hexsz) < 0 ||
 	    write_in_full(fd, &term, 1) < 0 ||
 	    fsync_component(FSYNC_COMPONENT_REFERENCE, get_lock_file_fd(&lock->lk)) < 0 ||
 	    close_ref_gently(lock) < 0) {
@@ -3223,7 +3223,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
 			rollback_lock_file(&reflog_lock);
 		} else if (update &&
 			   (write_in_full(get_lock_file_fd(&lock->lk),
-				oid_to_hex(&cb.last_kept_oid), the_hash_algo->hexsz) < 0 ||
+				oid_to_hex(&cb.last_kept_oid), refs->base.repo->hash_algo->hexsz) < 0 ||
 			    write_str_in_full(get_lock_file_fd(&lock->lk), "\n") < 0 ||
 			    close_ref_gently(lock) < 0)) {
 			status |= error("couldn't write %s",
-- 
2.45.1.190.g19fe900cfc.dirty


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

  parent reply	other threads:[~2024-05-16  8:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16  8:04 [PATCH 00/16] refs: drop all references to `the_repository` Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 01/16] refs: adjust names for `init` and `init_db` callbacks Patrick Steinhardt
2024-05-16 14:50   ` Karthik Nayak
2024-05-16  8:04 ` [PATCH 02/16] refs: rename `init_db` callback to avoid confusion Patrick Steinhardt
2024-05-16 15:00   ` Karthik Nayak
2024-05-16 18:24   ` Junio C Hamano
2024-05-17  7:08     ` Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 03/16] refs: implement releasing ref storages Patrick Steinhardt
2024-05-16 16:39   ` Karthik Nayak
2024-05-16 18:01     ` Junio C Hamano
2024-05-17  7:09       ` Patrick Steinhardt
2024-05-17  7:08     ` Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 04/16] refs: track ref stores via strmap Patrick Steinhardt
2024-05-16 18:34   ` Junio C Hamano
2024-05-16  8:04 ` [PATCH 05/16] refs: pass repo when retrieving submodule ref store Patrick Steinhardt
2024-05-16 18:44   ` Junio C Hamano
2024-05-17  7:09     ` Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 06/16] refs: refactor `resolve_gitlink_ref()` to accept a repository Patrick Steinhardt
2024-05-16 18:45   ` Junio C Hamano
2024-05-16  8:04 ` [PATCH 07/16] refs: retrieve worktree ref stores via associated repository Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 08/16] refs: convert iteration over replace refs to accept ref store Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 09/16] refs: pass ref store when detecting dangling symrefs Patrick Steinhardt
2024-05-16  8:04 ` [PATCH 10/16] refs: move object peeling into "object.c" Patrick Steinhardt
2024-05-16 20:55   ` Junio C Hamano
2024-05-16  8:05 ` [PATCH 11/16] refs: pass repo when peeling objects Patrick Steinhardt
2024-05-16  8:05 ` [PATCH 12/16] refs: drop `git_default_branch_name()` Patrick Steinhardt
2024-05-16 18:44   ` Karthik Nayak
2024-05-16  8:05 ` [PATCH 13/16] refs: remove `dwim_log()` Patrick Steinhardt
2024-05-16  8:05 ` [PATCH 14/16] refs/files: use correct repository Patrick Steinhardt
2024-05-16  8:05 ` Patrick Steinhardt [this message]
2024-05-16  8:05 ` [PATCH 16/16] refs/packed: remove references to `the_hash_algo` Patrick Steinhardt
2024-05-16 18:57 ` [PATCH 00/16] refs: drop all references to `the_repository` Karthik Nayak
2024-05-17  7:08   ` 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=ab0c7937392c3067d56ff43079c91de70d4a19e0.1715836916.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).