From: Jeff King <peff@peff.net>
To: Mathias Rav <m@git.strova.dk>
Cc: git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: Re: [PATCH] files_initial_transaction_commit(): only unlock if locked
Date: Thu, 18 Jan 2018 09:19:14 -0500 [thread overview]
Message-ID: <20180118141914.GA32718@sigill.intra.peff.net> (raw)
In-Reply-To: <20180118143841.1a4c674d@novascotia>
On Thu, Jan 18, 2018 at 02:38:41PM +0100, Mathias Rav wrote:
> Running git clone --single-branch --mirror -b TAGNAME previously
> triggered the following error message:
>
> fatal: multiple updates for ref 'refs/tags/TAGNAME' not allowed.
>
> This error condition is handled in files_initial_transaction_commit().
>
> 42c7f7ff9 ("commit_packed_refs(): remove call to `packed_refs_unlock()`", 2017-06-23)
> introduced incorrect unlocking in the error path of this function,
> which changes the error message to
>
> fatal: BUG: packed_refs_unlock() called when not locked
>
> Move the call to packed_refs_unlock() above the "cleanup:" label
> since the unlocking should only be done in the last error path.
Thanks, this solution looks correct to me. It's pretty low-impact since
the locking is the second-to-last thing in the function, so we don't
have to re-add the unlock to a bunch of error code paths. But one
alternative would be to just do:
if (packed_refs_is_locked(refs))
packed_refs_unlock(refs->packed_ref_store);
in the cleanup section.
-Peff
next prev parent reply other threads:[~2018-01-18 14:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 13:38 [PATCH] files_initial_transaction_commit(): only unlock if locked Mathias Rav
2018-01-18 14:19 ` Jeff King [this message]
2018-01-19 22:14 ` Junio C Hamano
2018-01-22 9:25 ` Michael Haggerty
2018-01-22 10:03 ` Mathias Rav
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=20180118141914.GA32718@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=m@git.strova.dk \
--cc=mhagger@alum.mit.edu \
/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).