Re: [PATCH v2 3/5] refs: remove the_hash_algo global state
- From
Tian Yuchen <a3205153416@gmail.com>
- Date
- Mar 28, 2026, 17:03 UTC
- Message-ID
- <3ac6eb2a-4bd9-44e2-acef-cc80799925f5@gmail.com>
- In-Reply-To
- <20260328141146.1095115-4-shreyanshpaliwalcmsmn@gmail.com>
On 3/28/26 22:09, Shreyansh Paliwal wrote:
Show 9 quoted lines
> @@ -3153,7 +3150,7 @@ static int migrate_one_ref(const struct reference *ref, void *cb_data) > if (ret < 0) > goto done; > > - ret = ref_transaction_update(data->transaction, ref->name, NULL, null_oid(the_hash_algo), > + ret = ref_transaction_update(data->transaction, ref->name, NULL, null_oid(data->transaction->ref_store->repo->hash_algo), > symref_target.buf, NULL, > REF_SKIP_CREATE_REFLOG | REF_NO_DEREF, NULL, data->errbuf); > if (ret < 0)
I have no objection to the logic itself at all, but this line of code looks too long. ;)
If I were you, I would write:
const struct git_hash_algo *algo = data->transaction->ref_store->repo->hash_algo;
then: null_oid(algo)
Just wanted to remind you to pay attention to readability. There’s no need to reply to this email.
Thanks, Yuchen