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

Re: [PATCH RFC 0/5] Introduce git-blame-tree(1) command

From
Jeff King <peff@peff.net>
Date
May 15, 2025, 19:30 UTC
Message-ID
<20250515193046.GA3320240@coredump.intra.peff.net>
In-Reply-To
<a97db895-5121-427a-b64f-df225309f429@xiplink.com>
On Thu, May 15, 2025 at 01:39:59PM -0400, Marc Branchaud wrote:
Show 9 quoted lines
> > As an end-user, I view "where does the body of this function came
> > from" and "when did I touch this file the last time" quite different
> > and unrelated kind of queries.
> 
> I can see them either way, depending on how I squint.  I have no objection
> if people want to think of this new operation as
> something-that-is-not-a-blame.  But then don't call it blame-tree!
> 
> How about last-touch?

The name "blame-tree" is probably my fault, as that's what I called it in 2012 when I originally wrote it. I don't have access to the adjacent repos anymore, but I _think_ it was replacing a script that was in fact called "git-last-modified" or something like that. So it all comes around. ;)

The debate has mostly been over "blame" here. But I think "tree" is also inaccurate. Theoretically it can be about any set of paths in the repo, not just the entries of a single tree. So:

  git last-modified Makefile Documentation/Makefile t/Makefile

would be a perfectly valid thing to ask about (and of course a pathspec like '**Makefile' would be a simpler way to do so). The word "tree" was there because the original use case at GitHub was getting those values for all of the entries in a particular tree.

But conceptually it is just about expanding a pathspec into a set of paths, and then traversing and reporting the last time each path was modified. It _almost_ fits into the "git-log" family, which is all about traversing and pathspecs. The output is a bit different, but I almost wonder if it would work as an option to continuously limit the pathspec. Something like:

  $ git log --format=%H --last-modified --raw '**Makefile'
  89d557b950c7a0581c12452e8f9576c45546246b
  :100644 100644 13f9062a05 c4d21ccd3d M  Makefile
  [ skip a bunch of commits that touched only Makefile, nothing else ]
  a7fa5b2f0ccb567a5a6afedece113f207902fa6f
  :100644 100644 6485d40f62 b109d25e9c M  Documentation/Makefile
  [ skip more; now this one is interesting, because one commit touches a
    bunch of files! It also touches Documentation/Makefile, but we'd
    have already narrowed our pathspec to forget about it by this point ]
  5309c1e9fb399c390ed36ef476e91f76f6746fa9
  :100644 100644 3e67552cc5 97ce9c92fb M  contrib/credential/libsecret/Makefile
  :100644 100644 238f5f8c36 0948297e20 M  contrib/credential/osxkeychain/Makefile
  :100644 100644 6e992c0866 5b795fc9fe M  contrib/credential/wincred/Makefile
  :100644 100644 f2be7cc924 33c2ccc9f7 M  contrib/diff-highlight/Makefile
  :100644 100644 5ff5275496 2a98541477 M  contrib/diff-highlight/t/Makefile
  :100644 100644 4e603512a3 497ac434d6 M  contrib/mw-to-git/Makefile
  :100644 100644 f422203fa0 6c9f377caa M  contrib/mw-to-git/t/Makefile
  :100644 100644 52b84ba3d4 691737e76b M  contrib/persistent-https/Makefile
  :100644 100644 093399c788 2a85f5ee84 M  contrib/subtree/t/Makefile
  :100644 100644 667c39ed56 6c5a12bc32 M  git-gui/Makefile
  :100644 100644 749aa2e7ec e656b0d2b0 M  git-gui/po/glossary/Makefile
  :100644 100644 6911c2915a 4ff4ed0616 M  t/interop/Makefile
  :100644 100644 e4808aebed 9b3090c4ed M  t/perf/Makefile
  :100644 100644 bd1e9e30c1 722755338d M  templates/Makefile
  [ ... end immediately without traversing further here, since all
    paths have been reported ... ]

I dunno. I just made that up. The output is obviously quite different than blame-tree produces, but it would be easy-ish to collect it in the same way. And it's much more flexible, because you could use --format and diff options to report as much or as little about each commit as you'd want.

It is a bit different from regular log, though, in that we'd expand the pathspec at the very start, rather than applying it continuously as we traverse (otherwise we could never end early, since we'd never know if there was a "foo/Makefile" deep in history).

So you could argue that "git last-modified" could also just take format and diff output options. ;)

-Peff
Previous: Marc BranchaudNext: Patrick Steinhardt
Message 22 of 135 in “Introduce git-blame-tree(1) command”
  1. 0/5 Introduce git-blame-tree(1) commandToon Claes, Apr 22, 2025
  2. 1/5 blame-tree: introduce new subcommand to blame filesToon Claes, Apr 22, 2025
  3. Junio C HamanoApr 24, 2025
  4. Toon ClaesMay 7, 2025
  5. 2/5 t/perf: add blame-tree perf scriptToon Claes, Apr 22, 2025
  6. 3/5 blame-tree: use Bloom filters when availableToon Claes, Apr 22, 2025
  7. 4/5 blame-tree: implement faster algorithmToon Claes, Apr 22, 2025
  8. 5/5 blame-tree.c: initialize revision machinery without walkToon Claes, Apr 22, 2025
  9. Marc BranchaudApr 23, 2025
  10. Toon ClaesMay 7, 2025
  11. Marc BranchaudMay 7, 2025
  12. Junio C HamanoMay 7, 2025
  13. Marc BranchaudMay 8, 2025
  14. Junio C HamanoMay 8, 2025
  15. Marc BranchaudMay 8, 2025
  16. Toon ClaesMay 14, 2025
  17. Junio C HamanoMay 14, 2025
  18. Marc BranchaudMay 14, 2025
  19. Patrick SteinhardtMay 15, 2025
  20. Junio C HamanoMay 15, 2025
  21. Marc BranchaudMay 15, 2025
  22. Jeff KingMay 15, 2025
  23. Patrick SteinhardtMay 16, 2025
  24. Toon ClaesMay 20, 2025
  25. Marc BranchaudMay 15, 2025
  26. Patrick SteinhardtMay 16, 2025
  27. Marc BranchaudMay 14, 2025
  28. Kristoffer HaugsbakkMay 7, 2025
  29. D. Ben KnobleMay 8, 2025
  30. Marc BranchaudMay 8, 2025
  31. D. Ben KnobleMay 8, 2025
  32. 0/5 Introduce git-last-modified(1) commandToon Claes, May 23, 2025
  33. 1/5 last-modified: new subcommand to show when files were last modifiedToon Claes, May 23, 2025
  34. Justin ToblerMay 25, 2025
  35. Toon ClaesJun 5, 2025
  36. Patrick SteinhardtMay 27, 2025
  37. Toon ClaesJun 13, 2025
  38. Kristoffer HaugsbakkJun 13, 2025
  39. 2/5 t/perf: add last-modified perf scriptToon Claes, May 23, 2025
  40. 3/5 last-modified: use Bloom filters when availableToon Claes, May 23, 2025
  41. Patrick SteinhardtMay 27, 2025
  42. Toon ClaesJun 13, 2025
  43. 4/5 last-modified: implement faster algorithmToon Claes, May 23, 2025
  44. Patrick SteinhardtMay 27, 2025
  45. 5/5 last-modified: initialize revision machinery without walkToon Claes, May 23, 2025
  46. Patrick SteinhardtMay 27, 2025
  47. Kristoffer HaugsbakkJul 1, 2025
  48. Junio C HamanoJul 1, 2025
  49. Kristoffer HaugsbakkJul 1, 2025
  50. Toon ClaesJul 2, 2025
  51. Toon ClaesJul 9, 2025
  52. Junio C HamanoJul 9, 2025
  53. 0/3 Introduce git-last-modified(1) commandToon Claes, Jun 30, 2025
  54. 1/3 last-modified: new subcommand to show when files were last modifiedToon Claes, Jun 30, 2025
  55. Kristoffer HaugsbakkJul 1, 2025
  56. Junio C HamanoJul 2, 2025
  57. 2/3 t/perf: add last-modified perf scriptToon Claes, Jun 30, 2025
  58. 3/3 last-modified: use Bloom filters when availableToon Claes, Jun 30, 2025
  59. Junio C HamanoJul 1, 2025
  60. 0/3 Introduce git-last-modified(1) commandToon Claes, Jul 9, 2025
  61. Junio C HamanoJul 9, 2025
  62. Junio C HamanoJul 10, 2025
  63. 0/6 Introduce git-last-modified(1) commandToon Claes, Jul 16, 2025
  64. 1/6 last-modified: new subcommand to show when files were last modifiedToon Claes, Jul 16, 2025
  65. Taylor BlauJul 18, 2025
  66. Jeff KingJul 19, 2025
  67. Toon ClaesJul 22, 2025
  68. Christian CouderAug 1, 2025
  69. Junio C HamanoAug 1, 2025
  70. 2/6 t/perf: add last-modified perf scriptToon Claes, Jul 16, 2025
  71. Taylor BlauJul 18, 2025
  72. Toon ClaesJul 22, 2025
  73. 3/6 last-modified: use Bloom filters when availableToon Claes, Jul 16, 2025
  74. Taylor BlauJul 18, 2025
  75. Toon ClaesJul 22, 2025
  76. 4/6 pretty: allow caller to disable indentationToon Claes, Jul 16, 2025
  77. Junio C HamanoJul 16, 2025
  78. Toon ClaesJul 17, 2025
  79. 5/6 last-modified: support --extended formatToon Claes, Jul 16, 2025
  80. Junio C HamanoJul 16, 2025
  81. Toon ClaesJul 17, 2025
  82. Junio C HamanoJul 17, 2025
  83. Junio C HamanoJul 18, 2025
  84. Toon ClaesJul 22, 2025
  85. 6/6 fixup! last-modified: use Bloom filters when availableToon Claes, Jul 16, 2025
  86. Taylor BlauJul 17, 2025
  87. Toon ClaesJul 22, 2025
  88. Toon ClaesJul 30, 2025
  89. Patrick SteinhardtJul 31, 2025
  90. 0/4 Introduce git-last-modified(1) commandToon Claes, Jul 30, 2025
  91. Junio C HamanoJul 31, 2025
  92. Junio C HamanoJul 31, 2025
  93. 0/3 Introduce git-last-modified(1) commandToon Claes, Aug 5, 2025
  94. Patrick SteinhardtAug 5, 2025
  95. Junio C HamanoAug 5, 2025
  96. Junio C HamanoAug 5, 2025
  97. Toon ClaesAug 5, 2025
  98. Jean-Noël AVILAAug 5, 2025
  99. Junio C HamanoAug 5, 2025
  100. Toon ClaesAug 6, 2025
  101. Junio C HamanoAug 6, 2025
  102. Junio C HamanoAug 28, 2025
  103. Junio C HamanoAug 5, 2025
  104. 1/3 last-modified: new subcommand to show when files were last modifiedToon Claes, Aug 5, 2025
  105. 2/3 t/perf: add last-modified perf scriptToon Claes, Aug 5, 2025
  106. 3/3 last-modified: use Bloom filters when availableToon Claes, Aug 5, 2025
  107. 1/4 last-modified: new subcommand to show when files were last modifiedToon Claes, Jul 30, 2025
  108. Patrick SteinhardtJul 31, 2025
  109. Toon ClaesAug 1, 2025
  110. Junio C HamanoAug 1, 2025
  111. Patrick SteinhardtAug 4, 2025
  112. Junio C HamanoAug 4, 2025
  113. Toon ClaesAug 5, 2025
  114. Jean-Noël AVILAAug 1, 2025
  115. Toon ClaesAug 5, 2025
  116. Patrick SteinhardtAug 4, 2025
  117. Christian CouderAug 1, 2025
  118. Patrick SteinhardtAug 1, 2025
  119. Junio C HamanoAug 1, 2025
  120. Christian CouderAug 2, 2025
  121. Christian CouderAug 2, 2025
  122. Christian CouderAug 2, 2025
  123. Junio C HamanoAug 2, 2025
  124. Patrick SteinhardtAug 4, 2025
  125. 2/4 t/perf: add last-modified perf scriptToon Claes, Jul 30, 2025
  126. 3/4 commit-graph: export prepare_commit_graph()Toon Claes, Jul 30, 2025
  127. Patrick SteinhardtJul 31, 2025
  128. 4/4 last-modified: use Bloom filters when availableToon Claes, Jul 30, 2025
  129. Patrick SteinhardtJul 31, 2025
  130. Toon ClaesAug 1, 2025
  131. Patrick SteinhardtAug 4, 2025
  132. 1/3 last-modified: new subcommand to show when files were last modifiedToon Claes, Jul 9, 2025
  133. 2/3 t/perf: add last-modified perf scriptToon Claes, Jul 9, 2025
  134. 3/3 last-modified: use Bloom filters when availableToon Claes, Jul 9, 2025
  135. 6/6 fixup! last-modified: use Bloom filters when availableToon Claes, Jul 16, 2025

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.