#876661 git: `git add -N` confuses the rename detector

Package:
git
Source:
git
Description:
fast, scalable, distributed revision control system
Submitter:
Andrea Stacchiotti
Date:
2017-09-24 16:09:04 UTC
Severity:
minor
#876661#5
Date:
2017-09-24 16:07:21 UTC
From:
To:
Dear Maintainer,

renaming a tracked file and then running `git add -N newname` seems to confuse
the
rename detection code, so that a subsequent `git status` displays a puzzling:

```
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        renamed:    oldname -> oldname
```

Everything works correctly if instead `git add newname` is used.

This might be a "feature" of the -N switch, but I was very confused by the faux
rename.

I attach a script that exhibits the problem, and its output on my system:

```
git init testrepo
Initialized empty Git repository in /tmp/testrepo/.git/
cd testrepo
touch orig
git add orig
git config user.name A
git config user.email B
git commit -m'orig'
[master (root-commit) 8c8431f] orig
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 orig

# Here it is
mv orig new
git add -N new
git status
Sul branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        renamed:    orig -> orig

no changes added to commit (use "git add" and/or "git commit -a")

# Cleanup
cd ..
rm -rf testrepo
```