git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug: git log -L manpage claims regexes are supported, but they are not
@ 2020-12-04  2:47 Daniel
  2020-12-04  2:54 ` Eric Sunshine
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel @ 2020-12-04  2:47 UTC (permalink / raw)
  To: git

Context:

   $ git version
git version 2.25.1

   $ git log -L ^/bootstrap-sass/,+2 Gemfile
fatal: -L argument not 'start,end:file' or ':funcname:file': 
^/bootstrap-sass/,+2


I expected the above to work, based on the contents of `git help log`, 
which describes the regex format.

This regex format works correctly in `git blame -L`, and it appears the 
manpage was copied across but not the implementation.


$ git help log

        -L <start>,<end>:<file>, -L :<funcname>:<file>
            Trace the evolution of the line range given by 
"<start>,<end>" (or the function name regex <funcname>) within the 
<file>. You may not give any pathspec limiters. This is
            currently limited to a walk starting from a single revision, 
i.e., you may only give zero or one positive revision arguments, and 
<start> and <end> (or <funcname>) must
            exist in the starting revision. You can specify this option 
more than once. Implies --patch. Patch output can be suppressed using 
--no-patch, but other diff formats (namely
            --raw, --numstat, --shortstat, --dirstat, --summary, 
--name-only, --name-status, --check) are not currently implemented.

            <start> and <end> can take one of these forms:

            •   number

                If <start> or <end> is a number, it specifies an 
absolute line number (lines count from 1).

            •   /regex/

                This form will use the first line matching the given 
POSIX regex. If <start> is a regex, it will search from the end of the 
previous -L range, if any, otherwise from the
                start of file. If <start> is “^/regex/”, it will search 
from the start of file. If <end> is a regex, it will search starting at 
the line given by <start>.

            •   +offset or -offset

                This is only valid for <end> and will specify a number 
of lines before or after the line given by <start>.

            If “:<funcname>” is given in place of <start> and <end>, it 
is a regular expression that denotes the range from the first funcname 
line that matches <funcname>, up to the
            next funcname line. “:<funcname>” searches from the end of 
the previous -L range, if any, otherwise from the start of file. 
“^:<funcname>” searches from the start of file.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug: git log -L manpage claims regexes are supported, but they are not
  2020-12-04  2:47 Bug: git log -L manpage claims regexes are supported, but they are not Daniel
@ 2020-12-04  2:54 ` Eric Sunshine
  2020-12-04  2:56   ` Daniel Heath
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sunshine @ 2020-12-04  2:54 UTC (permalink / raw)
  To: Daniel; +Cc: Git List

On Thu, Dec 3, 2020 at 9:50 PM Daniel <daniel@heath.cc> wrote:
>    $ git log -L ^/bootstrap-sass/,+2 Gemfile
> fatal: -L argument not 'start,end:file' or ':funcname:file':
> ^/bootstrap-sass/,+2
>
> $ git help log
>         -L <start>,<end>:<file>, -L :<funcname>:<file>

You're missing the colon between <end> and <file> in your example. It should be:

    $ git log -L ^/bootstrap-sass/,+2:Gemfile

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug: git log -L manpage claims regexes are supported, but they are not
  2020-12-04  2:54 ` Eric Sunshine
@ 2020-12-04  2:56   ` Daniel Heath
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Heath @ 2020-12-04  2:56 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: Git List

Thanks very much! 

I was thrown by `git blame` having an almost-identical but opposite interface (must use a space and not a colon).

Thanks,
Daniel Heath

On Fri, Dec 4, 2020, at 1:54 PM, Eric Sunshine wrote:
> On Thu, Dec 3, 2020 at 9:50 PM Daniel <daniel@heath.cc> wrote:
> >    $ git log -L ^/bootstrap-sass/,+2 Gemfile
> > fatal: -L argument not 'start,end:file' or ':funcname:file':
> > ^/bootstrap-sass/,+2
> >
> > $ git help log
> >         -L <start>,<end>:<file>, -L :<funcname>:<file>
> 
> You're missing the colon between <end> and <file> in your example. It should be:
> 
>     $ git log -L ^/bootstrap-sass/,+2:Gemfile
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-04  2:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04  2:47 Bug: git log -L manpage claims regexes are supported, but they are not Daniel
2020-12-04  2:54 ` Eric Sunshine
2020-12-04  2:56   ` Daniel Heath

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 NNTP newsgroup(s).