git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Kevin Ballard <kevin@sb.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Documentation/git-filter-branch.txt: Fix description of --commit-filter
Date: Fri, 30 May 2008 16:41:57 -0700	[thread overview]
Message-ID: <7v63svgy0q.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <98EEBDF4-9964-4CA6-ABBD-DB72C4F6CAD3@sb.org> (Kevin Ballard's message of "Fri, 30 May 2008 16:07:38 -0700")

Kevin Ballard <kevin@sb.org> writes:

>> But I am also confused by the new description:
>>
>>        In that history, we will make sure that rewritten D (original
>>        commit being C) have A as parent.  IOW, we will have
>>
>>                --A'--C'  D'
>>                         /
>>                        A
>>
>> which is not what happens.  What it does is that the commits in the
>> output
>> from the filter (i.e. A) are first mapped to the corresponding
>> commits in
>> the rewritten history (i.e. A'), and they will be used as the
>> parents of
>> the rewritten commit, to form this history:
>>
>>                --A'--C'
>>
>> isn't it?
>
> So basically, you think it's missing the fact that the emitted id is
> mapped to rewritten commits? From reading the git-filter-branch code,
> I don't think that's correct. When each commit is created, its
> original parents get mapped to new values, but the results of the
> commit-filter are dumped straight into the map.

Ah, I misread this part of the code:

	parentstr=
	for parent in $parents; do
		for reparent in $(map "$parent"); do
			parentstr="$parentstr -p $reparent"
		done
	done
	if [ "$filter_parent" ]; then
		parentstr="$(echo "$parentstr" | eval "$filter_parent")" ||
				die "parent filter failed: $filter_parent"
	fi

You get the commit object names from the new history, and you are supposed
to give back names from the new history from the filter.

So "the rewritten commit will have the output from parent-filter as its
parents" is what happens, right?

IOW, in the history in the previous message, when rewriting C (to create
C'), the filter will get A' and B' (i.e. from the new history), and can
choose to return A', and that is recorded when creating C'.  "the
rewritten children of the commit" in your:

    +commit ids; in that case, the rewritten children of the original
    +commit will have all of them as parents.

sounded as if you are talking about D' not C', and that was what I was
confused about.

> To give an example, let's examine your tree. A will be processed
> first, and A' gets put into the map for A. B gets processed next (or
> maybe before A, but that's irrelevant) and B' gets put into the map
> for B. C gets processed, and it emits A, so A goes into the map for C.

Hmm?  I meant C is rewritten to become C' but when it does so filter can
remove B from its parent set (iow, the filter is told that unless it
intervenes C' will have A' and B' as its parents, but the filter can
choose to return only A').  So I do not quite get "it emits A" part.  Do
you mean "the filter outputs A'"?  Also do you mean by "map" the mapping
from <A, B, C> to <A', B', C'> commit namespace?  If so, even when the
filter "emits A'", I do not think it "goes into the map for C".  When the
filter "emits A'", it is used as _the_ single parent to create C', and it
is C' that "goes into the map for C".  Am I still confused?

Now, I admit that I did not look at the implementation of the "map" in the
code quoted above.  Perhaps that thing is busted, I dunno.

  reply	other threads:[~2008-05-30 23:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 21:43 [PATCH] Documentation/git-filter-branch.txt: Fix description of --commit-filter Kevin Ballard
2008-05-30 22:52 ` Junio C Hamano
2008-05-30 23:07   ` Kevin Ballard
2008-05-30 23:41     ` Junio C Hamano [this message]
2008-05-31  0:33       ` Kevin Ballard
2008-05-31  1:48         ` Junio C Hamano
2008-05-31 22:33           ` Junio C Hamano
2008-05-31 23:50             ` Kevin Ballard

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=7v63svgy0q.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=kevin@sb.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.
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).