git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Kevin Ballard <kevin@sb.org>, Yann Dirson <dirson@bertin.fr>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH 0/2] [RFD] Using gitrevisions :/search style with other operators
Date: Wed, 8 Dec 2010 20:47:42 +0100	[thread overview]
Message-ID: <201012082047.44022.jnareb@gmail.com> (raw)
In-Reply-To: <1291820319-12455-1-git-send-email-pclouds@gmail.com>

On Wed, 8 Dec 2010, Nguyễn Thái Ngọc Duy wrote:

> Let's start off from where the previous discussion [1] stopped. People
> seem to agree ref^{/regex} is a good choice. But we have not come to
> conclusion how to specify the count yet. Possible suggestions are
> 
>  - ref^{/foo}2
>  - ref^{2/foo}
>  - ref^{:2/foo}
>  - ref^{2nd/foo}
> 
> For whatever syntax chosen, :/ should benefit too. I notice that :/!
> is reserved for future use. Perhaps :/!2/regex is not too cryptic?

I wonder if it would be possible to make :/<regex> (which looks a bit
like searching the index) to be an alias to --all^{/<regex>}...

Or if we can make ^{/<regex>} to act on revision range specified by
earlier commits, so for example foo..bar^{/<regex>} would work.

> I'd also like to do case-insensitive regex, by the way. :/!2i/regex
> looks a bit ugly.

The '2nd' idea came from Perl 6 regexp / grammars, see for example
https://github.com/perlpilot/perl6-docs/blob/master/intro/p6-regex-intro.pod

 There are two other modifiers for matching a pattern some number of times
 or only matching, say, the third time we see a pattern in a string. These
 modifiers are a little strange in that their short-hand forms consist of
 a number followed by some text:

    modifier        short-hand              meaning
    :x()            :1x,:4x,:12x            match some number of times
    :nth()          :1st,:2nd,:3rd,:4th     match only the Nth occurance

 Here are some examples to illustrate these modifiers:

    $_ = "foo bar baz blat";
    m :3x/ a /              # matches the "a" characters in each word
    m :nth(3)/ \w+ /        # matches "baz"

So it could be e.g. 'foo^{:2nd/<regexp>}' (note that there is no trailing
/ closing regexp, i.e. it is not 'foo^{:2nd/<regexp>/}').

So if we chose this, why don't we follow Perl 6 rule of combining modifiers
http://perlcabal.org/syn/S05.html#Modifiers, so it would be

   foo^{:2nd:i/<regexp>}

or

   foo^{:i:nth(2)/<regexp>}


As to :/!<regexp> form: isn't it reserved for non-match?  If not, then
perhaps

  :/!2nd:i/<regexp>

> [1] http://mid.gmane.org/9D675671-693D-4B59-AF2A-0EFE4C537362@sb.org
> 
> Nguyễn Thái Ngọc Duy (2):
>   get_sha1_oneline: allow to input commit_list
>   get_sha1: support ref^{/regex} syntax
> 
>  Documentation/revisions.txt |    7 ++++++
>  sha1_name.c                 |   45 ++++++++++++++++++++++++++++++++----------
>  2 files changed, 41 insertions(+), 11 deletions(-)

Thank you for working on this.
-- 
Jakub Narebski
Poland

  parent reply	other threads:[~2010-12-08 19:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08 14:58 [PATCH 0/2] [RFD] Using gitrevisions :/search style with other operators Nguyễn Thái Ngọc Duy
2010-12-08 14:58 ` [PATCH 1/2] get_sha1_oneline: allow to input commit_list Nguyễn Thái Ngọc Duy
2010-12-08 15:11   ` Thiago Farina
2010-12-08 14:58 ` [PATCH 2/2] get_sha1: support ref^{/regex} syntax Nguyễn Thái Ngọc Duy
2010-12-08 22:50   ` Junio C Hamano
2010-12-08 18:06 ` [PATCH 0/2] [RFD] Using gitrevisions :/search style with other operators Jonathan Nieder
2010-12-08 19:51   ` Jakub Narebski
2010-12-09  1:28     ` Nguyen Thai Ngoc Duy
2010-12-09  1:54       ` Jakub Narebski
2010-12-09  1:59         ` Jonathan Nieder
2010-12-09  2:02           ` Kevin Ballard
2010-12-09  2:06             ` Nguyen Thai Ngoc Duy
2010-12-09  2:11               ` Jonathan Nieder
2010-12-09  6:22           ` Junio C Hamano
2010-12-09 11:38             ` Jakub Narebski
2010-12-10 13:25             ` Nguyen Thai Ngoc Duy
2010-12-10 19:03               ` Jonathan Nieder
2010-12-10 19:26                 ` Jakub Narebski
2010-12-10 21:21                 ` Kevin Ballard
2010-12-10 21:30                   ` Jeff King
2010-12-10 23:08                   ` Junio C Hamano
2010-12-10 23:11                     ` Kevin Ballard
2010-12-10 23:36                       ` Junio C Hamano
2010-12-09  5:15     ` Junio C Hamano
2010-12-08 19:47 ` Jakub Narebski [this message]
2010-12-08 20:40   ` Jonathan Nieder
2010-12-09  0:30   ` Nguyen Thai Ngoc Duy
2010-12-09  0:44     ` Jakub Narebski
2010-12-09  1:42       ` Nguyen Thai Ngoc Duy
2010-12-09  1:46         ` Kevin Ballard
2010-12-09 11:43         ` Jakub Narebski
2010-12-09 11:53           ` Nguyen Thai Ngoc Duy

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012082047.44022.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=dirson@bertin.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kevin@sb.org \
    --cc=pclouds@gmail.com \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).