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

Re: [PATCH] blame: add a range option to -L

From
BPBill Pemberton <wfp5p@viridian.itc.virginia.edu>
Date
May 3, 2010, 12:46 UTC
Message-ID
<20100503124610.DB96C41205@viridian.itc.virginia.edu>
In-Reply-To
<20100502091433.GA1854@progeny.tock>
Show 7 quoted lines
> > In addition to + and - you can now use r to specify how many lines
> > around <start> that you want to see.  For example: -L 20,r5 would show
> > lines 15 through 25
> 
> >From too much exposure to subversion, the r suggests “revision”.
> But ± is too hard to type, so I guess r will have to do.
> 

I wasn't too thrilled with using r either, but I couldn't think of anything better.

Show 12 quoted lines
> > +		/* if top is negative then top is actually a range
> > +		   that was specified with the r option */
> > +		if (*top < 1) {
> > +		    long x = *top;
> > +		    *top = *bottom - x;
> > +		    *bottom += x;
> > +		    if (*bottom < 1)
> > +			*bottom = 1;
> > +		}
> 
> How does this treat -L 5,-10?
> 

Yes, you're correct, my code will mess that up. I thought I had verified that parse_loc() would never return a number less than 1 as *top, but looking again I see I didn't do that. So my patch is no good. Sorry folks.

-- 
Bill Pemberton                                 wfp5p@virginia.edu
ITC/Unix Systems                               flash@virginia.edu
University of Virginia
Previous: Bill Pemberton
Message 6 of 6 in “blame: add a range option to -L”
  1. blame: add a range option to -LBill Pemberton, Apr 30, 2010
  2. Jonathan NiederMay 2, 2010
  3. Michael WittenMay 2, 2010
  4. Junio C HamanoMay 2, 2010
  5. Bill PembertonMay 3, 2010
  6. Bill PembertonMay 3, 2010

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.