git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Which branch(es) contain certain commits? (was Re: (unknown))

From
ICIvan Chernyavsky <camposer@yandex.ru>
Date
Aug 21, 2015, 21:29 UTC
Message-ID
<5570041440192599@web21j.yandex.ru>
In-Reply-To
<xmqqh9nxerfv.fsf@gitster.dls.corp.google.com>
17.08.2015, 20:49, "Junio C Hamano" <gitster@pobox.com>:
Show 10 quoted lines
>  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
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 12 in “(unknown)”
  1. Ivan ChernyavskyAug 5, 2015
  2. Which branch(es) contain certain commits? (was Re: (unknown))Junio C Hamano, Aug 5, 2015
  3. Junio C HamanoAug 5, 2015
  4. Ivan ChernyavskyAug 5, 2015
  5. Duy NguyenAug 15, 2015
  6. Ivan ChernyavskyAug 17, 2015
  7. Junio C HamanoAug 17, 2015
  8. Which branch(es) contain certain commits? (was Re: (unknown))Ivan Chernyavsky, Aug 21, 2015
  9. Junio C HamanoAug 21, 2015
  10. Ivan ChernyavskyAug 22, 2015
  11. Ivan ChernyavskyAug 22, 2015
  12. Karthik NayakAug 22, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.