Re: [PATCH 06/20] refs/files: remove "name exist?" check in lock_ref_oid_basic()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 14, 2021, 20:53 UTC
- Message-ID
- <xmqqh7djba6e.fsf@gitster.g>
- In-Reply-To
- <patch-06.20-3162bf28505-20211013T235900Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 21 quoted lines
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 0af6ee44552..0dd21b2e205 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -1013,16 +1013,6 @@ static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,
> CALLOC_ARRAY(lock, 1);
>
> files_ref_path(refs, &ref_file, refname);
> - if (!refs_resolve_ref_unsafe(&refs->base, refname,
> - RESOLVE_REF_NO_RECURSE,
> - &lock->old_oid, type)) {
> - if (!refs_verify_refname_available(&refs->base, refname,
> - NULL, NULL, err))
> - strbuf_addf(err, "unable to resolve reference '%s': %s",
> - refname, strerror(errno));
> -
> - goto error_return;
> - }
>
> /*
> * If the ref did not exist and we are creating it, make sureThis has the side effect of "type" not touched at all by this function, which in turn triggers "type is used uninitialized?" error in files_reflog_expire() that calls this function.