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

Re: Multiple line ranges and files in line level history browser

From
Bo Yang <struggleyb.nku@gmail.com>
Date
May 11, 2010, 05:43 UTC
Message-ID
<AANLkTimCT7euE0CjGBx88MlfVJhxVo1GdOtnMhtZqBQs@mail.gmail.com>
In-Reply-To
<7v1vdl9btm.fsf@alter.siamese.dyndns.org>

Hi, On Mon, May 10, 2010 at 2:20 AM, Junio C Hamano <gitster@pobox.com> wrote:

Show 8 quoted lines
>> If there is no opposition for this kind of option syntax, I will try
>> to implement it in revision.c. ;-)
>
> I'd rather not to see this in revision.c at all.  The revision.c parser
> has always been options and then pathspecs and never takes individual
> filnames, except for "--follow" that is an afterthought checkbox hack that
> lets the main parser parse and then reject a generic pathspec after the
> fact.
Ok, this will be put in the builtin/log.c
Show 15 quoted lines
> I think the right place to do this sort of thing is in the incremental
> output of "blame".  The command only takes individual filenames and never
> takes general pathspecs, it knows about -L as line-range (and as far as I
> see, it is the only command that does so) and I think its output routine
> already has the right infrastructure for doing this.  The "--incremental"
> output itself is designed for porcelain scripts to interpret and do the UI
> around it, but that does not mean it can have another mode that gives
> human readable output.  When "blame --incremental" emits the record that
> says "these lines are blamed to this path in this commit", it has already
> run internally necessary "diff" between blobs to find that
> information---you should be able to re-run the diff (or keep the output
> from "diff" around, but I would suggest against it) and show something
> like "git log -p" output but is limited to the hunks that actually touch
> the areas that we are following.
>

Hmm, maybe I should say something about my general plan about how to implement the line level browser here.

Generally, I plan to change two place in major to make the history of
line ranges.
1. The definition of TREESAME. TREESAME will be changed to consider
the line ranges if -L option is given;
With this, the history simplification can be done very well for line
level history traversal. And even well for parent rewriting to support
--graph option.
Also, line tracing will be done along the process of the history
simplification in the same time. And the tracing algorithm will be
written in another new source file and get called in revision.c (maybe
file_change and file_add_remove)...
2. The diff format, maybe a DIFF_FORMAT_LINE option will be added, and
a new function builtin_diffline() will be added to output the line
level diffs.

This has some difference with my original proposal on the source files which need to modify. But I think this is the right way to do things after I have digged more into git source code. I hope this very rough idea can help you to understand what my following patches will look like.

Regards! Bo

-- 
My blog: http://blog.morebits.org
Previous: Junio C HamanoNext: Thomas Rast
Message 3 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.