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