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

Re: [PATCH] revision traversal: Add --refs=<pattern> option

From
Junio C Hamano <junkio@cox.net>
Date
Nov 27, 2006, 23:59 UTC
Message-ID
<7vhcwke90a.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<11646401513369-git-send-email-vsu@altlinux.ru>
Sergey Vlasov <vsu@altlinux.ru> writes:
Show 8 quoted lines
> Add the --refs=<pattern> option, which can be used to select a
> subset of refs matching the specified glob pattern.
>
> Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
> ---
>
>  If --all-branches is too specific for the mentioned use case,
>  what about adding a more general glob pattern match?

Traditionally any new option to rev-list must be accompanied with a matching change to rev-parse. I do not know offhand how strictly we should adhere to this rule these days; it depends on how people's script use rev-list.

Before revision.c "revision walking library" was done, many Porcelain-ish commands were implemented as a pipeline that plugs rev-list output to diff-tree. These shell scripts took parameters from the command line, and rev-parse was used to separate parameters (both "flags" that begin with a dash and "non-flags" that don't) that should be given to rev-list and the other parameters (meant to be used by the shell script itself but often are given straight to the downstream diff-tree). The rev-parse command has even the --sq option to facilitate this usage:

	rev_opts=`git rev-parse --sq --default=HEAD --revs "$@"`
	diff_opts=`git rev-parse --sq --no-revs "$@"`
        eval "git-rev-list $rev_opts" |
        eval "git-diff-tree --stdin $diff_opts"

so that it can even pass -S'I want to find this string' to diff-tree without worrying about spaces.

I personally feel that part of rev-parse outlived its usefulness (--flags, --no-flags, --revs-only, and --no-revs). It was a useful hack, and served us well, but it was a hack.

In that sense it probably is Ok to leave it unmaintained, but it might be a good idea to plan deprecating it, given that we have been talking about UI warts. If there are pipelines that can be easily formed (with the help of rev-parse "parameter sifter"), but whose functionality cannot be easily emulated with the current crop of Porcelain-ish, we should work on polishing the Porcelain-ish to make the pipelines unnecessary.

The remaining parts of rev-parse (the most important of which is the --verify option) should probably stay. The original question of "list all the branches" can be done with:

	git rev-parse --symbolic --branches
Previous: Sergey VlasovNext: Marco Costalba
Message 7 of 10 in “Possible BUG with git-rev-list --all in a StGit repository”
  1. Marco CostalbaNov 26, 2006
  2. Junio C HamanoNov 26, 2006
  3. Marco CostalbaNov 27, 2006
  4. Marco CostalbaNov 27, 2006
  5. Junio C HamanoNov 27, 2006
  6. revision traversal: Add --refs=<pattern> optionSergey Vlasov, Nov 27, 2006
  7. Junio C HamanoNov 27, 2006
  8. Marco CostalbaNov 28, 2006
  9. Junio C HamanoNov 28, 2006
  10. Marco CostalbaNov 28, 2006

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.