From: Thomas Gummerer <t.gummerer@gmail.com>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Joel Teichroeb <joel@teichroeb.net>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Jeff King <peff@peff.net>
Subject: Re: [PATCH 2/3] merge: use refresh_and_write_cache
Date: Thu, 29 Aug 2019 19:00:05 +0100 [thread overview]
Message-ID: <20190829180005.GC48344@cat> (raw)
In-Reply-To: <CAN0heSrs42hL7gmqMuugGLNOV8Vd9gxPcUiLA5oTXnhPEM-9qw@mail.gmail.com>
On 08/28, Martin Ågren wrote:
> On Tue, 27 Aug 2019 at 12:15, Thomas Gummerer <t.gummerer@gmail.com> wrote:
>
> > struct lock_file lock = LOCK_INIT;
> > const char *head_arg = "HEAD";
> >
> > - hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
> > - refresh_cache(REFRESH_QUIET);
> > - if (write_locked_index(&the_index, &lock,
> > - COMMIT_LOCK | SKIP_IF_UNCHANGED))
> > - return error(_("Unable to write index."));
> > + if (refresh_and_write_cache(REFRESH_QUIET, COMMIT_LOCK | SKIP_IF_UNCHANGED) < 0)
> > + return -1;
>
> I wondered why you didn't drop the `struct lock_file`, but it turns out
> we still need it further down.
>
> > if (!strcmp(strategy, "recursive") || !strcmp(strategy, "subtree")) {
> > int clean, x;
>
> What you could do, I guess, is to move its declaration to around here.
> Probably not worth a re-roll.
I'll re-roll anyway for the things you spotted in the first patch, so
I'll drop it down here while I'm at it, thanks!
> > @@ -860,13 +857,9 @@ static int merge_trivial(struct commit *head, struct commit_list *remoteheads)
> > {
> > struct object_id result_tree, result_commit;
> > struct commit_list *parents, **pptr = &parents;
> > - struct lock_file lock = LOCK_INIT;
> >
> > - hold_locked_index(&lock, LOCK_DIE_ON_ERROR);
> > - refresh_cache(REFRESH_QUIET);
> > - if (write_locked_index(&the_index, &lock,
> > - COMMIT_LOCK | SKIP_IF_UNCHANGED))
> > - return error(_("Unable to write index."));
> > + if (refresh_and_write_cache(REFRESH_QUIET, COMMIT_LOCK | SKIP_IF_UNCHANGED) < 0)
> > + return -1;
>
> Here you do drop the `struct lock_file` entirely, ok.
>
>
>
> Martin
next prev parent reply other threads:[~2019-08-29 18:00 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 10:14 [PATCH 0/3] make sure stash refreshes the index properly Thomas Gummerer
2019-08-27 10:14 ` [PATCH 1/3] factor out refresh_and_write_cache function Thomas Gummerer
2019-08-28 15:49 ` Martin Ågren
2019-08-29 17:59 ` Thomas Gummerer
2019-08-27 10:14 ` [PATCH 2/3] merge: use refresh_and_write_cache Thomas Gummerer
2019-08-28 15:52 ` Martin Ågren
2019-08-29 18:00 ` Thomas Gummerer [this message]
2019-08-27 10:14 ` [PATCH 3/3] stash: make sure to write refreshed cache Thomas Gummerer
2019-08-29 18:27 ` [PATCH v2 0/3] make sure stash refreshes the index properly Thomas Gummerer
2019-08-29 18:27 ` [PATCH v2 1/3] factor out refresh_and_write_cache function Thomas Gummerer
2019-08-30 15:07 ` Martin Ågren
2019-08-30 17:06 ` Junio C Hamano
2019-09-02 17:15 ` Thomas Gummerer
2019-09-03 17:43 ` Junio C Hamano
2019-08-29 18:27 ` [PATCH v2 2/3] merge: use refresh_and_write_cache Thomas Gummerer
2019-08-29 18:27 ` [PATCH v2 3/3] stash: make sure to write refreshed cache Thomas Gummerer
2019-09-03 19:10 ` [PATCH v3 0/3] make sure stash refreshes the index properly Thomas Gummerer
2019-09-03 19:10 ` [PATCH v3 1/3] factor out refresh_and_write_cache function Thomas Gummerer
2019-09-05 22:00 ` Junio C Hamano
2019-09-06 14:18 ` Thomas Gummerer
2019-09-11 10:57 ` Johannes Schindelin
2019-09-11 17:52 ` Thomas Gummerer
2019-09-12 16:46 ` Junio C Hamano
2019-09-03 19:10 ` [PATCH v3 2/3] merge: use refresh_and_write_cache Thomas Gummerer
2019-09-03 19:10 ` [PATCH v3 3/3] stash: make sure to write refreshed cache Thomas Gummerer
2019-09-11 18:20 ` [PATCH v4 0/3] make sure stash refreshes the index properly Thomas Gummerer
2019-09-11 18:20 ` [PATCH v4 1/3] factor out refresh_and_write_cache function Thomas Gummerer
2019-09-11 18:20 ` [PATCH v4 2/3] merge: use refresh_and_write_cache Thomas Gummerer
2019-09-11 18:20 ` [PATCH v4 3/3] stash: make sure to write refreshed cache Thomas Gummerer
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=20190829180005.GC48344@cat \
--to=t.gummerer@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=joel@teichroeb.net \
--cc=martin.agren@gmail.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).