git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Junio C Hamano <gitster@pobox.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH v3 4/4] fast-export: make sure refs are updated properly
Date: Tue, 30 Oct 2012 17:37:21 -0700	[thread overview]
Message-ID: <20121031003721.GV15167@elie.Belkin> (raw)
In-Reply-To: <1351623987-21012-5-git-send-email-felipe.contreras@gmail.com>

Felipe Contreras wrote:

> --- a/builtin/fast-export.c
> +++ b/builtin/fast-export.c
> @@ -523,11 +523,16 @@ static void get_tags_and_duplicates(struct object_array *pending,
>  				typename(e->item->type));
>  			continue;
>  		}
> -		if (commit->util) {
> -			/* more than one name for the same object */
> +
> +		/*
> +		 * This ref will not be updated through a commit, lets make
> +		 * sure it gets properly upddated eventually.
> +		 */
> +		if (commit->util || commit->object.flags & SHOWN) {
>  			if (!(commit->object.flags & UNINTERESTING))
>  				string_list_append(extra_refs, full_name)->util = commit;
> -		} else
> +		}
> +		if (!commit->util)
>  			commit->util = full_name;

Here's an explanation of why the above makes sense to me.

get_tags_and_duplicates() gets called after the marks import and
before the revision walk.  It walks through the revs from the
commandline and for each one:

 - peels it to a refname, and then to a commit
 - stores the refname so fast-export knows what arg to pass to
   the "commit" command during the revision walk
 - if it already had a refname stored, instead adds the
   (refname, commit) pair to the extra_refs list, so fast-export
   knows to add a "reset" command later.

If the commit already has the SHOWN flag set because it was pointed to
by a mark, it is not going to come up in the revision walk, so it will
not be mentioned in the output stream unless it is added to
extra_refs.  That's what this patch does.

Incidentally, the change from "else" to "if (!commit->util)" is
unnecessary because if a commit is already SHOWN then it will not be
encountered in the revision walk so commit->util does not need to be
set.

If the commit does not have the SHOWN or UNINTERESTING flag set but it
is going to get the UNINTERESTING flag set during the walk because of
a negative commit listed on the command line, this patch won't help.

Jonathan

  parent reply	other threads:[~2012-10-31  0:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 19:06 [PATCH v3 0/4] fast-export: general fixes Felipe Contreras
2012-10-30 19:06 ` [PATCH v3 1/4] fast-export: trivial cleanup Felipe Contreras
2012-10-30 19:06 ` [PATCH v3 2/4] fast-export: fix comparisson in tests Felipe Contreras
2012-10-30 19:06 ` [PATCH v3 3/4] fast-export: don't handle uninteresting refs Felipe Contreras
2012-10-30 19:06 ` [PATCH v3 4/4] fast-export: make sure refs are updated properly Felipe Contreras
2012-10-31  0:11   ` [PATCH v2 " Jonathan Nieder
2012-10-31  2:08     ` Felipe Contreras
2012-10-31  0:37   ` Jonathan Nieder [this message]
2012-10-31  1:33     ` [PATCH v3 " Sverre Rabbelier
2012-10-31  6:05       ` Jonathan Nieder
2012-10-31  9:53         ` [OT] How to get the discussion details via notes Peter Baumann
2012-10-31 12:29           ` Drew Northup
2012-10-31 14:10           ` Jeff King
2012-11-01  7:49             ` Peter Baumann
2012-10-31  2:13     ` [PATCH v3 4/4] fast-export: make sure refs are updated properly Felipe Contreras
2012-11-02 13:12     ` Jeff King
2012-11-02 14:55       ` Jonathan Nieder
2012-11-02 15:17       ` Johannes Schindelin
2012-11-02 15:19         ` Jeff King
2012-11-02 15:35           ` Felipe Contreras
2012-11-02 15:34       ` Felipe Contreras

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=20121031003721.GV15167@elie.Belkin \
    --to=jrnieder@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=srabbelier@gmail.com \
    /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).