Package: git
Version: 1:2.14.1+next.20170914-1
Severity: minor
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
```
-- System Information:
Debian Release: buster/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.12.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8),
LANGUAGE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages git depends on:
ii git-man 1:2.14.1+next.20170914-1
ii libc6 2.24-17
ii libcurl3-gnutls 7.55.1-1
ii liberror-perl 0.17024-1
ii libexpat1 2.2.3-1
ii libpcre2-8-0 10.22-3
ii perl 5.26.0-8
ii zlib1g 1:1.2.8.dfsg-5
Versions of packages git recommends:
ii less 481-2.1
ii openssh-client [ssh-client] 1:7.5p1-10
ii patch 2.7.5-1+b2
Versions of packages git suggests:
ii gettext-base 0.19.8.1-4
pn git-cvs <none>
pn git-daemon-run | git-daemon-sysvinit <none>
pn git-doc <none>
pn git-el <none>
pn git-email <none>
pn git-gui <none>
pn git-mediawiki <none>
pn git-svn <none>
ii gitk 1:2.14.1+next.20170914-1
pn gitweb <none>
-- no debconf information
#!/bin/bash
set -ev
git init testrepo
cd testrepo
touch orig
git add orig
git config user.name A
git config user.email B
git commit -m'orig'
# Here it is
mv orig new
git add -N new
git status
# Cleanup
cd ..
rm -rf testrepo