From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 6/8] commit: provide a fast multi-tip contains function
Date: Thu, 26 Jun 2014 12:19:52 -0700 [thread overview]
Message-ID: <xmqqha374gx3.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqqtx774i1r.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Thu, 26 Jun 2014 11:55:28 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> The only time you can say "Ah, we've seen this one and no need to
> dig further" is when you are propagating a colour C and the parent
> in question is already painted in C (it is OK to be painted as
> reachable from more tips), I would think, so shouldn't the loop be
> more like, after painting each tip and placing it in the queue:
>
> * Dequeue one, check the L/R bits in it and call that C
>
> * Iterate over its parents P:
>
> * check the L/R bits in P and call that Cp.
>
> * If Cp is already a superset of C, there is no point putting P
> to the queue to be processed.
>
> * If Cp is not a superset of C, then update L/R bits in P to mark
> it reachable from tips represented by C and put P to the queue.
>
> until you ran out of queue?
Actually that will cause you to dig down to the root, so it won't be
nice.
If you are trying to do "branch --with $commit", what you would want
is not exactly "paint-down-to-common(all branches, $commit)", but
something that paints down to $commit from all branches, with an
optimization that cuts off the traversal at a commit that is
reachable from $commit. If a traversal from branch B reached such a
commit that is reachable from $commit, you can stop the traversal
because propagating the bit for B further down to its parents will
not reach the $commit you are interested in.
So the termination condition for this a single Left (I'll use Left
for $commit and Right for "all branches") case is "if a commit is
already painted as reachable from $commit, do not propagate bits
further down".
What does it mean to look for "branch --with $commit1 $commit2"
(i.e. more than one in the Left set)? If we are trying to see which
branches reach _both_ of these commits, then replace the ablve with
"if a commit is already painted as reachable from both $commit{1,2},
then painting it with any branch bits is futile---its parents will
never reach either $commit1 nor $commit2", so the additional
termination condition will be "If left bits are full, then stop".
I do not know how you can optimize the traversal if you are trying
to see which branches reach at least one of these commits, though.
next prev parent reply other threads:[~2014-06-26 19:20 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-25 23:34 [PATCH 0/8] use merge-base for tag --contains Jeff King
2014-06-25 23:35 ` [PATCH 1/8] tag: allow --sort with -n Jeff King
2014-06-25 23:35 ` [PATCH 2/8] tag: factor out decision to stream tags Jeff King
2014-06-25 23:39 ` [PATCH 3/8] paint_down_to_common: use prio_queue Jeff King
2014-07-01 16:23 ` Junio C Hamano
2014-07-01 17:10 ` Jeff King
2014-06-25 23:40 ` [PATCH 4/8] add functions for memory-efficient bitmaps Jeff King
2014-06-26 3:15 ` Torsten Bögershausen
2014-06-26 15:51 ` Jeff King
2014-06-29 7:41 ` Eric Sunshine
2014-06-30 17:07 ` Jeff King
2014-07-01 16:57 ` Junio C Hamano
2014-07-01 17:18 ` Jeff King
2014-06-25 23:42 ` [PATCH 5/8] string-list: add pos to iterator callback Jeff King
2014-07-01 17:45 ` Junio C Hamano
2014-07-01 19:00 ` Jeff King
2014-06-25 23:47 ` [PATCH 6/8] commit: provide a fast multi-tip contains function Jeff King
2014-06-26 18:55 ` Junio C Hamano
2014-06-26 19:19 ` Junio C Hamano [this message]
2014-06-26 19:26 ` Junio C Hamano
2014-07-01 18:16 ` Junio C Hamano
2014-07-01 19:14 ` Junio C Hamano
2014-06-25 23:49 ` [PATCH 7/8] tag: use commit_contains Jeff King
2014-06-25 23:53 ` [PATCH 8/8] perf: add tests for tag --contains Jeff King
2014-06-26 0:01 ` Jeff King
2014-06-26 0:04 ` Jeff King
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=xmqqha374gx3.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.