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

[PATCH v8 0/5] git log -L

From
Thomas Rast <trast@student.ethz.ch>
Date
Feb 28, 2013, 16:38 UTC
Message-ID
<cover.1362069310.git.trast@student.ethz.ch>
Here's another shot :-)
For an instructive example, apply it and run
  git log -L:archiver:archive.h
in your git.git.

Last time around, apart from some minor issues, there was one main point discussed[1]: it should be possible to do the line-log in two separate steps, one for filtering and one for the diffing.

That would have some really nice advantages, in particular it would let us generate the diff within the usual diff chain. That way it would work together with e.g. --word-diff automatically.

However, with the whole diff chain IMHO already being in some disarray, that's such a far-off goal (and a good example of gsoc scope creep!) that I can't see myself working on it in the near future unless someone decides to pay me for working on Git. Meanwhile, this seems to be the only blocker for the inclusion of a feature for which all feedback has been "WANT!" since it worked for the first time.

So I'd rather settle for including this slightly hacky version, and then improving on it incrementally.

There are more things that need to be done: my rewrite for readability (see [1] again) lost the support for -C and -C -C, so it no longer is any use with big code moves. The only thing that currently works is -M, which will track the ranges across a file rename that can be detected by the diff engine (i.e., it works by letting the diff engine form a rename filepair).

Changes since v7 include:
- An all-new patch that allows for funcname matching: -L:pattern:file.
  I find it makes calling line-log (or blame, for that matter) much
  more natural.  I'm not exactly married to the syntax; in particular
  it feels weird in blame where you have to say 'git blame -L:foo file'.
  If you have better ideas, please shout.
- Tests!  Yay.  Also fixes for bugs found by the tests ;-)
- Dropped the unnecessary patch "Export three functions from diff.c".
Bo Yang (2):
  Refactor parse_loc
  Export rewrite_parents() for 'log -L'
Thomas Rast (3):
  blame: introduce $ as "end of file" in -L syntax
  Implement line-history search (git log -L)
  log -L: :pattern:file syntax to find by funcname
 Documentation/blame-options.txt     |   19 +-
 Documentation/git-log.txt           |   22 +
 Documentation/line-range-format.txt |   31 +
 Makefile                            |    2 +
 builtin/blame.c                     |   99 +--
 builtin/log.c                       |   31 +
 line-log.c                          | 1433 +++++++++++++++++++++++++++++++++++
 line-log.h                          |   80 ++
 log-tree.c                          |    4 +
 revision.c                          |   22 +-
 revision.h                          |   16 +-
 t/t4211-line-log.sh                 |   42 +
 t/t4211/expect.beginning-of-file    |   43 ++
 t/t4211/expect.end-of-file          |   62 ++
 t/t4211/expect.move-support-f       |   40 +
 t/t4211/expect.simple-f             |   59 ++
 t/t4211/expect.simple-f-to-main     |  100 +++
 t/t4211/expect.simple-main          |   68 ++
 t/t4211/expect.simple-main-to-end   |   70 ++
 t/t4211/expect.two-ranges           |  102 +++
 t/t4211/expect.vanishes-early       |   39 +
 t/t4211/history.export              |  330 ++++++++
 t/t8003-blame-corner-cases.sh       |    6 +
 23 files changed, 2601 insertions(+), 119 deletions(-)
 create mode 100644 Documentation/line-range-format.txt
 create mode 100644 line-log.c
 create mode 100644 line-log.h
 create mode 100755 t/t4211-line-log.sh
 create mode 100644 t/t4211/expect.beginning-of-file
 create mode 100644 t/t4211/expect.end-of-file
 create mode 100644 t/t4211/expect.move-support-f
 create mode 100644 t/t4211/expect.simple-f
 create mode 100644 t/t4211/expect.simple-f-to-main
 create mode 100644 t/t4211/expect.simple-main
 create mode 100644 t/t4211/expect.simple-main-to-end
 create mode 100644 t/t4211/expect.two-ranges
 create mode 100644 t/t4211/expect.vanishes-early
 create mode 100644 t/t4211/history.export
-- 
1.8.2.rc1.388.g1bd82c8
Next: Thomas Rast
Message 1 of 21 in “git log -L”
  1. 0/5 git log -LThomas Rast, Feb 28, 2013
  2. 1/5 Refactor parse_locThomas Rast, Feb 28, 2013
  3. Junio C HamanoFeb 28, 2013
  4. Thomas RastFeb 28, 2013
  5. 2/5 blame: introduce $ as "end of file" in -L syntaxThomas Rast, Feb 28, 2013
  6. Junio C HamanoFeb 28, 2013
  7. Junio C HamanoMar 12, 2013
  8. Thomas RastMar 13, 2013
  9. Junio C HamanoMar 13, 2013
  10. 3/5 Export rewrite_parents() for 'log -L'Thomas Rast, Feb 28, 2013
  11. Junio C HamanoFeb 28, 2013
  12. 4/5 Implement line-history search (git log -L)Thomas Rast, Feb 28, 2013
  13. Junio C HamanoFeb 28, 2013
  14. Thomas RastFeb 28, 2013
  15. Junio C HamanoFeb 28, 2013
  16. Thomas RastFeb 28, 2013
  17. Junio C HamanoFeb 28, 2013
  18. Thomas RastMar 1, 2013
  19. Thomas RastMar 1, 2013
  20. 5/5 log -L: :pattern:file syntax to find by funcnameThomas Rast, Feb 28, 2013
  21. Junio C HamanoFeb 28, 2013

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.