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

Re: Could git status know about -M ?

From
Jeff King <peff@peff.net>
Date
Mar 30, 2007, 04:19 UTC
Message-ID
<20070330041923.GA9320@coredump.intra.peff.net>
In-Reply-To
<20070330000949.GB41089@dspnet.fr.eu.org>
On Fri, Mar 30, 2007 at 02:09:49AM +0200, Olivier Galibert wrote:
> Right now git status shows renames only if the deleted file is
> strictly identical to the added file.  If you do an even minor
> modification (say, change a "" include to a <> one) it becomes a
> del/add pair which is way less readable.  Easily fixable?

It uses the same rename detection as git-diff, which computes a similarity score. For example, try this:

  $ git init
  $ head -n 1000 /usr/share/dict/words >foo
  $ git-add foo; git-commit -m 'added file'
  $ git-mv foo bar
  $ git-status ;# shows rename because files are identical
  $ echo changes >>bar; git-add bar
  $ git-status ;# still shows rename because files are similar
  $ echo rewrite >bar; git-add bar
  $ git-status ;# now files are too dissimilar to find rename

My guess is that your changes, even though they seem small, or preventing the rename detection from working. If you have a very small file, even a few changes can make the files too dissimilar.

-Peff
Previous: Olivier Galibert
Message 2 of 2 in “Could git status know about -M ?”
  1. Olivier GalibertMar 30, 2007
  2. Jeff KingMar 30, 2007

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.