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

Re: git index: how does it work?

From
Shaun Cutts <shaun@cuttshome.net>
Date
Aug 12, 2009, 18:45 UTC
Message-ID
<410DBF0B-80A2-4235-B566-B622CA976DA0@cuttshome.net>
In-Reply-To
<fabb9a1e0908121047jf7e6cf1n757cde626c79830c@mail.gmail.com>
Aha ---
that explains it, then.

Is there a lower-level interface to rename detection than via "status"? And... um... hmmm.... how does it work? The hash codes don't help for "almost" the same. Is there an approximate string matching algorithm built in somewhere?

Thanks,
-- Shaun
On Aug 12, 2009, at 7:47 PM, Sverre Rabbelier wrote:
Show 25 quoted lines
> Heya,
>
> On Wed, Aug 12, 2009 at 04:52, Shaun Cutts<shaun@cuttshome.net> wrote:
>> Are renames being tracked by the index, and is there a more basic  
>> interface
>> than "status" to query about them?
>
> Nope, git never explicitly tracks renames. Try this:
> $ mv foo bar
> $ git rm --cached foo
> $ git add bar
> $ git status
>
> It'll tell you that you renamed foo to bar, even if you never  
> executed 'git mv'.
>
> This is because git does rename _detection_, that is, it'll notice
> that you have another file with (almost) the same contents, so it
> assumes you did a rename.
>
> -- 
> Cheers,
>
> Sverre Rabbelier
>
Previous: Sverre RabbelierNext: Björn Steinbrink
Message 5 of 9 in “git index: how does it work?”
  1. Shaun CuttsAug 5, 2009
  2. Junio C HamanoAug 5, 2009
  3. Shaun CuttsAug 12, 2009
  4. Sverre RabbelierAug 12, 2009
  5. Shaun CuttsAug 12, 2009
  6. Björn SteinbrinkAug 12, 2009
  7. Junio C HamanoAug 12, 2009
  8. Sverre RabbelierAug 5, 2009
  9. Shaun CuttsAug 5, 2009

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.