All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Chernyavsky <camposer@yandex.ru>
To: Junio C Hamano <gitster@pobox.com>, Duy Nguyen <pclouds@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Which branch(es) contain certain commits? (was Re: (unknown))
Date: Sat, 22 Aug 2015 00:29:59 +0300	[thread overview]
Message-ID: <5570041440192599@web21j.yandex.ru> (raw)
In-Reply-To: <xmqqh9nxerfv.fsf@gitster.dls.corp.google.com>



17.08.2015, 20:49, "Junio C Hamano" <gitster@pobox.com>:
>  Duy Nguyen <pclouds@gmail.com> writes:
>
>>   On Wed, Aug 5, 2015 at 7:47 PM, Ivan Chernyavsky <camposer@yandex.ru> wrote:
>
>  That is a dangeous thought. I'd understand if it were internally
>  two step process, i.e. (1) the first pass finds commits that hits
>  the --grep criteria and then (2) the second pass does "--contains"
>  for all the hits found in the first pass using existing code, but
>  still, this operation is bound to dig all the way through the root
>  of the history when asked to find something that does not exist.

My intention was to use existing git-branch filters such as -a or -r and pattern to limit the scope, then apply --grep machinery.

But now I had a look on the source and I can see that builtin/branch.c builds the list of references and prints them in a single place (print_ref_list()) so I will have to split that function into two in order to reuse existing functionality.

Another problem is that builtin/branch.c currently does not use setup_revisions(), so I'll have to hook it there as well.

Then, I assume, I'll need to use the initial ref_list (filled the same as for the current "list" case) to configure the rev_info structure after setup_revisions(), and start revision traversal.

I'm not sure I've got it all right from the source in those few days, so I apologize in advance if it's stupid in some part or as a whole.

That said, do you think the goal is worth such changes? Seems like git-branch currently has it's own way of doing things and I'm trying to teach it to use git-rev-list's.

Maybe it is more reasonable to add an option to "git log --all --source --grep=..." to print *all* branch tips which are reachable from the found commits, not only the first one encountered? E.g. --decorate-all or --source-all?

>  You should at least feed all --contains to a single invocation of
>  "git branch". They are designed to be OR'ed together.


Yep thanks I overlooked that. In my repository, this takes 40 seconds instead of 2 minutes 30 seconds for my construct.

-- 
  Ivan

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

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 12:47 (unknown) Ivan Chernyavsky
2015-08-05 17:03 ` Which branch(es) contain certain commits? (was Re: (unknown)) Junio C Hamano
2015-08-05 17:05   ` Junio C Hamano
2015-08-05 19:48     ` Ivan Chernyavsky
2015-08-15  9:19 ` Duy Nguyen
2015-08-17  6:45   ` Which branch(es) contain certain commits? (was Re: (unknown)) Ivan Chernyavsky
2015-08-17 17:49   ` Junio C Hamano
2015-08-21 21:29     ` Ivan Chernyavsky [this message]
2015-08-21 22:39       ` Which branch(es) contain certain commits? (was Re: (unknown)) Junio C Hamano
2015-08-22  9:19         ` Ivan Chernyavsky
2015-08-22 10:32           ` Ivan Chernyavsky
2015-08-22 10:59           ` Karthik Nayak

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=5570041440192599@web21j.yandex.ru \
    --to=camposer@yandex.ru \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@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.
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.