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

Re: [PATCH] t4202 (log): add failing test for log with subtree

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 22, 2013, 16:32 UTC
Message-ID
<7vk3nupltx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<87wqruk2pj.fsf@linux-k42r.v.cablecom.net>
Thomas Rast <trast@inf.ethz.ch> writes:
Show 13 quoted lines
> So (I think?) in the above you claim that $USER interprets
>
>   git log -- README.md
>
> as
>
>   Show me the history of README.md.
>
> But there's no such thing as the history of a file!  The command instead
> says
>
>   If I filter all history for only changes affecting a path 'README.md'
>   in the root of the repository[1], then what does it look like?

Correct. The "design principle" I did not quote from your message comes from one of the most important messages in the list archive ($gmane/217).

Three issues with "--follow" are:
 (1) It uses the given pathname as single pathspec and drill down
     the same way without "--follow" until it notices the path
     disappears and until then there is no attempt to detect renames
     is made.  And it only does -M variant of rename detection
 (2) The "same way" in (1) includes the merge simplification to cull
     side branches if one parent matches the end result.  In a
     history where the first parent of a merge M, i.e. M^1, did not
     have path F, its second parent M^2 had path F, and the merge
     result M deposited the contents of M^2:F at M:D/F, then running
     "log --follow F" starting from M would notice that the end
     result M did not have F in it, which is shared with its first
     parent M^1, and culls the side branch M^2.  The --full-history
     option may let you keep the history leading to M^2, though.
 (3) When (1) notices that the path being followed did not exist in
     any of the parents (be it a merge or a non-merge) and finds a
     different path with a similar looking content, it _switches_
     the pathspec to it, but the single pathspec it uses is a global
     state and affects traversals of other ancestry paths at the
     same time.  Because of this, "--follow" will not work correctly
     in a history that contains merges.  It often _appears_ to work
     only by accident.

The first two are relatively minor (the second is not even an issue).

To solve the last one, you would need to keep track of which path it is following per traversal path.

Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 30 of 34 in “t4202 (log): add failing test for log with subtree”
  1. t4202 (log): add failing test for log with subtreeRamkumar Ramachandra, Apr 22, 2013
  2. Matthieu MoyApr 22, 2013
  3. Thomas RastApr 22, 2013
  4. Ramkumar RamachandraApr 22, 2013
  5. Ramkumar RamachandraApr 22, 2013
  6. Ramkumar RamachandraApr 22, 2013
  7. Matthieu MoyApr 22, 2013
  8. Thomas RastApr 22, 2013
  9. Thomas RastApr 22, 2013
  10. Ramkumar RamachandraApr 22, 2013
  11. Ramkumar RamachandraApr 22, 2013
  12. Thomas RastApr 22, 2013
  13. Ramkumar RamachandraApr 22, 2013
  14. Ramkumar RamachandraApr 22, 2013
  15. Ramkumar RamachandraApr 22, 2013
  16. Ramkumar RamachandraApr 22, 2013
  17. Thomas RastApr 22, 2013
  18. Ramkumar RamachandraApr 22, 2013
  19. Philip OakleyApr 22, 2013
  20. Ramkumar RamachandraApr 22, 2013
  21. Ramkumar RamachandraApr 22, 2013
  22. Matthieu MoyApr 22, 2013
  23. Junio C HamanoApr 22, 2013
  24. Ramkumar RamachandraApr 22, 2013
  25. Ramkumar RamachandraApr 22, 2013
  26. Junio C HamanoApr 22, 2013
  27. Ramkumar RamachandraApr 23, 2013
  28. Junio C HamanoApr 23, 2013
  29. Ramkumar RamachandraApr 23, 2013
  30. Junio C HamanoApr 22, 2013
  31. Ramkumar RamachandraApr 22, 2013
  32. Matthieu MoyApr 22, 2013
  33. Junio C HamanoApr 22, 2013
  34. Ramkumar RamachandraApr 22, 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.