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

Multiple line ranges and files in line level history browser

From
Bo Yang <struggleyb.nku@gmail.com>
Date
May 9, 2010, 14:00 UTC
Message-ID
<p2q41f08ee11005090700xdb6070dajab0e2d77b1d0f9fc@mail.gmail.com>
Hi,
    Since we want to support to browse the history of multiple line
ranges in multiple files, so we should design a workable way to let
users specify these kind of thing. Generally, git revision walking
mechanism support syntax like:
git log <revision> -- <file1> <file2>

That's that we can specify one revision and multiple files one time. And the dashdash is optional. And I want to introduce a new way for line ranges argument based on this, that is something like:

git log <revision> -L1,8 -L45,+6 <file1> -L/some/,/end/ -L9,29 <file2> <file3>

That's that putting the line ranges arguments just before the filename argument. And here, no dashdash should be provided by users, if there is, all the following arguments are still take considered as normal filenames. And this helps if there are some files in your working directory called '-L1,8'... Yes, you can always try to browse the line level history of such a strange file by 'git log -L1,8 <revision> -- -L1,8' .

And the principle for this:
1. After '--', all following arguments are treated as filenames, just
as what we do now;
2. After any <filename>, all following arguments are treated as
whether ranges or filenames, using -L to separate;
3. '-L' can be specified at any place, and all ranges will be assigned
to the first filename following the '-L';
4. If some file has no '-L', we will display the normal log for that
file just like git log -p <file>.

Since '-L' option is also used by many other command, I don't know the exact impact of this, anyway we can use another name anytime...

If there is no opposition for this kind of option syntax, I will try to implement it in revision.c. ;-)

Regards! Bo

-- 
My blog: http://blog.morebits.org
Next: Junio C Hamano
Message 1 of 9 in “Multiple line ranges and files in line level history browser”
  1. Bo YangMay 9, 2010
  2. Junio C HamanoMay 9, 2010
  3. Bo YangMay 11, 2010
  4. Thomas RastMay 12, 2010
  5. Jonathan NiederMay 9, 2010
  6. Jonathan NiederMay 10, 2010
  7. Bo YangMay 11, 2010
  8. Bo YangMay 11, 2010
  9. Jonathan NiederMay 11, 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.