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

Re: git-mv redux: there must be something else going on

From
RGRon Garret <ron1@flownet.com>
Date
Feb 3, 2010, 20:31 UTC
Message-ID
<ron1-176898.12310803022010@news.gmane.org>
In-Reply-To
<ron1-34F9C6.12273203022010@news.gmane.org>
In article <ron1-34F9C6.12273203022010@news.gmane.org>,
 Ron Garret <ron1@flownet.com> wrote:
Show 49 quoted lines
> In article <alpine.LFD.2.00.1002031436490.1681@xanadu.home>,
>  Nicolas Pitre <nico@fluxnic.net> wrote:
> 
> > On Wed, 3 Feb 2010, Ron Garret wrote:
> > 
> > > So... how *does* git decide when two blobs are different blobs and when 
> > > they are the same blob with mods?  I asked this question before and was 
> > > pointed to the diffcore docs, but that didn't really clear things up.  
> > > That just describes all the different ways git can do diffs, not the 
> > > actual heuristics that git uses to track content.
> > 
> > Yes, those same heuristics are used to make the decision.
> > 
> > |The second transformation in the chain is diffcore-break, and is
> > |controlled by the -B option to the 'git diff-{asterisk}' commands.  
> > |This is used to detect a filepair that represents "complete rewrite" 
> > |and break such filepair into two filepairs that represent delete and
> > |create.
> > |[...]
> > 
> > |This transformation is used to detect renames and copies, and is
> > |controlled by the -M option (to detect renames) and the -C option
> > |(to detect copies as well) to the 'git diff-{asterisk}' commands.  
> > |[...]
> > 
> > Note that you may use the -B, -C, -M and --find-copies-harder arguments 
> > with log as well as diff commands even if there is no actual diff 
> > output.  So the explanation is really in that document even if simple 
> > rename detection is concerned only by a fraction of what is said there.
> > 
> > And Git can detect copied files too.
> > 
> > Those semantics are not stored in the repository so they can be improved 
> > or even changed after the facts.
> 
> OK, on closer reading I see that the information is there, but it's well 
> hidden :-)  (For example, the -M option takes an optional numerical 
> argument so you can tweak how much similarity is needed to be considered 
> a move.  But the docs for git log don't mention this.  It's buried deep 
> in the git diffcore docs.  But yes, it's there.)
> 
> So I think I'm beginning to understand how this works, but that leads me 
> to another question: it seems to me that there are potential screw cases 
> for this purely content-based system of tracking files.  For example, 
> suppose I have a directory full of sample config files, all of which are 
> similar to each other.  Will that cause diffcore to get confused?
> 
> Feel free to treat that as a rhetorical question because obviously I can 
> (and probably should) get the answer by trying it.

Actually, I think the answer is in Avery's post in another branch of this thread.

rg
Previous: Ron GarretNext: Avery Pennarun
Message 8 of 20 in “git-mv redux: there must be something else going on”
  1. Ron GarretFeb 3, 2010
  2. Avery PennarunFeb 3, 2010
  3. Ron GarretFeb 3, 2010
  4. Avery PennarunFeb 3, 2010
  5. Ron GarretFeb 3, 2010
  6. Nicolas PitreFeb 3, 2010
  7. Ron GarretFeb 3, 2010
  8. Ron GarretFeb 3, 2010
  9. Avery PennarunFeb 3, 2010
  10. Ron GarretFeb 3, 2010
  11. Avery PennarunFeb 3, 2010
  12. Jay SoffianFeb 3, 2010
  13. Ron GarretFeb 4, 2010
  14. Ron GarretFeb 4, 2010
  15. Junio C HamanoFeb 4, 2010
  16. Nicolas PitreFeb 3, 2010
  17. Pete HarlanFeb 3, 2010
  18. Ron GarretFeb 3, 2010
  19. Documentation: clarify git-mv behaviour wrt dirty filesThomas Rast, Feb 3, 2010
  20. Junio C HamanoFeb 3, 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.