git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: David Aguilar <davvid@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Paul Tan <pyokagan@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 2/3] am: do not corrupt the index stat state
Date: Fri, 21 Aug 2015 09:37:22 -0700	[thread overview]
Message-ID: <xmqqk2so7g3h.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1440144151-24026-2-git-send-email-davvid@gmail.com> (David Aguilar's message of "Fri, 21 Aug 2015 01:02:30 -0700")

David Aguilar <davvid@gmail.com> writes:

> Reported-by: Linus Torvalds
> Signed-off-by: David Aguilar <davvid@gmail.com>
> @@ -1975,10 +1977,20 @@ static int clean_index(const unsigned char *head, const unsigned char *remote)
>  
>  	memset(&pathspec, 0, sizeof(pathspec));
>  
> +	memset(&opts, 0, sizeof(opts));
> +	opts.fn = oneway_merge;
> +	opts.pathspec = &pathspec;
> +	opts.src_index = &the_index;
> +	opts.dst_index = &the_index;
> +	opts.head_idx = 1;
> +	opts.merge = 1;
> +	opts.reset = 1;
> +	init_tree_desc(&desc, remote_tree->buffer, remote_tree->size);
> +
>  	lock_file = xcalloc(1, sizeof(struct lock_file));
>  	hold_locked_index(lock_file, 1);
>  
> -	if (read_tree(remote_tree, 0, &pathspec)) {
> +	if (unpack_trees(1, &desc, &opts)) {

I think the same fix was done in 3ecc7040 (am --skip/--abort: merge
HEAD/ORIG_HEAD tree into index, 2015-08-19).

  reply	other threads:[~2015-08-21 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21  8:02 [PATCH 1/3] t4151: demonstrate that builtin am corrupts index' stat data David Aguilar
2015-08-21  8:02 ` [PATCH 2/3] am: do not corrupt the index stat state David Aguilar
2015-08-21 16:37   ` Junio C Hamano [this message]
2015-08-21  8:02 ` [PATCH 3/3] am: rename "struct tree_desc t" to "desc" for readability David Aguilar
2015-08-21 16:51   ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqk2so7g3h.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=pyokagan@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /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).