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

Re: [PATCH v7 0/5] git log -L, all new and shiny

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 15, 2012, 04:40 UTC
Message-ID
<7vlijpchm2.fsf@alter.siamese.dyndns.org>
In-Reply-To
<cover.1339063659.git.trast@student.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
Show 6 quoted lines
> I too thought it would never happen -- but then again this is still
> not ready, I'm just trying to give it some exposure.
> ...
> There's also a longer-term wishlist hinted at in the commit message of
> the main patch: the diff machinery currently makes no provisions for
> chaining its various bells and whistles.

I am not convinced that it is "diff machinery makes no provivsions" that is the problem. Isn't it coming from the way the series limits the output line range and reimplements its own output routine?

All the "bells and whistles" like diffstat, word coloring, etc. go through the xdi_diff_outf() interface, so isn't it the matter of limiting lines that this interface calls back the "bells and whistles" callback functions with?

When you enter the diff machinery, you have the path and the line range you are interested in of one side (lets say you are comparing side A and B, and have line range for side A).

If you
 - add a mechanism to pass the "interesting" line range and path
   down to the callchain from xdi_diff_outf() to xdiff_outf();
 - make one of these functions filter out (i.e. not call the
   callback xdiff_emit_consume_fn) hunks that do not overlap with
   the line range you are interested in (I would presume that they
   would be a few new fields in xdemitconf_t structure); and
 - while recording the corresponding line ranges in the other side
   of the hunks that are output,
that would give you
 - output that is limited to the "interesting" input range of side A;
 - the corresponding "interesting" range in the other side of the
   comparison, so that you can update the "interesting" range to
   feed to the next diff that compares side B with something else; and
 - for whatever processing the various "bells and whistles" callers
   already implement, as all their callbacks see are the lines in
   your "interesting" range.
No?  Am I missing something?
Previous: Zbigniew Jędrzejewski-SzmekNext: Thomas Rast
Message 13 of 18 in “git log -L, all new and shiny”
  1. 0/5 git log -L, all new and shinyThomas Rast, Jun 7, 2012
  2. 1/5 Refactor parse_locThomas Rast, Jun 7, 2012
  3. 2/5 blame: introduce $ as "end of file" in -L syntaxThomas Rast, Jun 7, 2012
  4. Junio C HamanoJun 7, 2012
  5. Thomas RastJun 7, 2012
  6. 3/5 Export three functions from diff.cThomas Rast, Jun 7, 2012
  7. Junio C HamanoJun 7, 2012
  8. 4/5 Export rewrite_parents() for 'log -L'Thomas Rast, Jun 7, 2012
  9. 5/5 Implement line-history search (git log -L)Thomas Rast, Jun 7, 2012
  10. Junio C HamanoJun 7, 2012
  11. Thomas RastJun 7, 2012
  12. Zbigniew Jędrzejewski-SzmekJun 10, 2012
  13. Junio C HamanoJun 15, 2012
  14. Thomas RastJun 15, 2012
  15. Junio C HamanoJun 15, 2012
  16. Junio C HamanoJun 16, 2012
  17. Thomas RastJun 19, 2012
  18. Junio C HamanoJun 19, 2012

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.