From: "Martin Ågren" <martin.agren@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
Subject: Re: [PATCH 3/5] merge-recursive: always roll back lock in `merge_recursive_generic()`
Date: Wed, 28 Feb 2018 12:02:02 +0100 [thread overview]
Message-ID: <CAN0heSqmWAN=rCO8busGtb0xNPiB5H_jkL664qH8xasPq1Sy0A@mail.gmail.com> (raw)
In-Reply-To: <b19db05a8d8a98977788c04908134915eebc86a3.1519763396.git.martin.agren@gmail.com>
On 27 February 2018 at 22:30, Martin Ågren <martin.agren@gmail.com> wrote:
> If we return early, we forget to roll back the lockfile. Do so.
>
> Signed-off-by: Martin Ågren <martin.agren@gmail.com>
> ---
> merge-recursive.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/merge-recursive.c b/merge-recursive.c
> index cc5fa0a949..7345125691 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> @@ -2198,8 +2198,10 @@ int merge_recursive_generic(struct merge_options *o,
> hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
> clean = merge_recursive(o, head_commit, next_commit, ca,
> result);
> - if (clean < 0)
> + if (clean < 0) {
> + rollback_lock_file(&lock);
> return clean;
> + }
>
> if (active_cache_changed &&
> write_locked_index(&the_index, &lock, COMMIT_LOCK))
This is incomplete. If "!active_cache_changed", this function fails to
roll back the lock. I'll reroll this series.
This also highlights the point Peff made in [1] about how that
"active_cache_changed &&" can be confusing. I'll look into the added or
extended API he proposed, although perhaps not as part of the reroll.
Martin
[1] https://public-inbox.org/git/20180227214430.GC6899@sigill.intra.peff.net/
next prev parent reply other threads:[~2018-02-28 11:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 21:30 [PATCH 0/5] roll back locks in various code paths Martin Ågren
2018-02-27 21:30 ` [PATCH 1/5] sequencer: make lockfiles non-static Martin Ågren
2018-02-27 21:30 ` [PATCH 2/5] sequencer: always roll back lock in `do_recursive_merge()` Martin Ågren
2018-02-27 21:44 ` Jeff King
2018-02-27 22:08 ` Martin Ågren
2018-02-27 22:15 ` Jeff King
2018-02-27 21:30 ` [PATCH 3/5] merge-recursive: always roll back lock in `merge_recursive_generic()` Martin Ågren
2018-02-28 11:02 ` Martin Ågren [this message]
2018-02-28 19:07 ` [PATCH v2 0/5] roll back locks in various code paths Martin Ågren
2018-02-28 19:07 ` [PATCH v2 1/5] sequencer: make lockfiles non-static Martin Ågren
2018-02-28 19:07 ` [PATCH v2 2/5] sequencer: always roll back lock in `do_recursive_merge()` Martin Ågren
2018-02-28 19:07 ` [PATCH v2 3/5] merge-recursive: always roll back lock in `merge_recursive_generic()` Martin Ågren
2018-02-28 19:07 ` [PATCH v2 4/5] merge: always roll back lock in `checkout_fast_forward()` Martin Ågren
2018-02-28 19:07 ` [PATCH v2 5/5] sequencer: do not roll back lockfile unnecessarily Martin Ågren
2018-02-28 19:58 ` [PATCH v2 0/5] roll back locks in various code paths Martin Ågren
2018-02-28 23:20 ` Junio C Hamano
2018-03-01 6:18 ` Martin Ågren
2018-03-01 7:41 ` Jeff King
2018-03-01 19:24 ` Junio C Hamano
2018-03-01 20:40 ` Martin Ågren
2018-03-02 10:49 ` Jeff King
2018-03-01 7:38 ` Jeff King
2018-02-27 21:30 ` [PATCH 4/5] merge: always roll back lock in `checkout_fast_forward()` Martin Ågren
2018-02-27 21:30 ` [PATCH 5/5] sequencer: do not roll back lockfile unnecessarily Martin Ågren
2018-02-27 21:47 ` [PATCH 0/5] roll back locks in various code paths Jeff King
2018-02-27 23:42 ` Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN0heSqmWAN=rCO8busGtb0xNPiB5H_jkL664qH8xasPq1Sy0A@mail.gmail.com' \
--to=martin.agren@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).