Thread (2 messages) 2 messages, 2 authors, 2023-12-28

Re: [PATCH 04/12] setup: start tracking ref storage format when

From: Patrick Steinhardt <hidden>
Date: 2023-12-28 08:56:29
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

On Wed, Dec 20, 2023 at 10:30:28AM -0800, Junio C Hamano wrote:
There is a topic in-flight that introduces the .compat_hash_algo
member to the repo_fmt structure.  Seeing a conflict resolution like
the attached (there are many others that are similar in spirit), I
have to wonder if we want to add repo_set_ref_storage_format()
helper function.  There are many assignments to .ref_storage_format
member after this series is applied.

Note that I haven't read the series in full, so take the above with
a grain of salt---it might turn out to be that direct assignment is
more desirable, I dunno.

Thanks.
Wrapping this in a `repo_set_ref_storage_format()` doesn't add much for
now, but on the other hand it also doesn't hurt and is more in line with
how we set the other formats. This could also be useful in the future to
have a central place for additional sanity checks, if required. So yeah,
let's do it.

Makes me wonder whether we should then also add the following diff to
"setup: set repository's format on init" when both topics are being
merged together:
diff --git a/setup.c b/setup.c
index 3d980814bc..3d35c78c68 100644
--- a/setup.c
+++ b/setup.c
@@ -2210,6 +2210,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
 	 * format we can update the repository's settings accordingly.
 	 */
 	repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
+	repo_set_compat_hash_algo(the_repository, repo_fmt.compat_hash_algo);
 	repo_set_ref_storage_format(the_repository, repo_fmt.ref_storage_format);
 
 	if (!(flags & INIT_DB_SKIP_REFDB))
Patrick

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help