# Bug report about symlinks

2 messages from 2014-07-30 to 2014-08-01. Participants: NickKolok, Dennis Kaarsemaker.
Thread: https://gitlist.dev/t/37246

## NickKolok, 2014-07-30 11:30

Subject: Bug report about symlinks
Message-ID: <1406719800.686251712@f362.i.mail.ru>
URL: https://gitlist.dev/e/1406719800.686251712%40f362.i.mail.ru

```
 Greetings from Russia, comrads!

I've noticed something strange with git status when replacing a folder with symlink to another folder.
There is a git repo with script with demo in the attachment.

Yours sincerely,
NickKolok aka Nikolay Avdeev.

Доброго времени суток, товарищи!

При замене папки на симлинк на другую папку с похожими, но не одинаковыми файлами git status ведёт себя странно.
Прилагаю архив с репозиторием. В скрипте - пример и пояснения.

С уважением,
Николай Авдеев aka NickKolok.
```

## Dennis Kaarsemaker, 2014-08-01 19:10

Subject: Re: Bug report about symlinks
Message-ID: <1406920259.3253.7.camel@spirit>
URL: https://gitlist.dev/e/1406920259.3253.7.camel%40spirit
In-Reply-To: <1406719800.686251712@f362.i.mail.ru>

```
On wo, 2014-07-30 at 15:30 +0400, NickKolok wrote:
> Greetings from Russia, comrads!
> 
> I've noticed something strange with git status when replacing a folder with symlink to another folder.
> There is a git repo with script with demo in the attachment.

I think there is a bug here:

+ mkdir bug
+ cd bug
+ git init
Initialized empty Git repository in /tmp/bug/.git/
+ mkdir dir1 dir2
+ echo 1
+ echo 1
+ echo 2a
+ echo 2b
+ git add dir1/1.txt dir1/2.txt dir2/1.txt dir2/2.txt
+ git commit -m first
[master (root-commit) b60ecc8] first
 4 files changed, 4 insertions(+)
 create mode 100644 dir1/1.txt
 create mode 100644 dir1/2.txt
 create mode 100644 dir2/1.txt
 create mode 100644 dir2/2.txt
+ rm -r dir2
+ ln -s dir1 dir2
+ git status
On branch master
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working
directory)

	deleted:    dir2/2.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	dir2

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

It looks like git status is thinking dir2/1.txt still exists with the
same content, even though dir2 is gone, and now an untracked symlink. 

Moreover, git diff and git status disagree with each other:

dennis@spirit:/tmp/bug$ git status
On branch master
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working
directory)

	deleted:    dir2/2.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	dir2

no changes added to commit (use "git add" and/or "git commit -a")
dennis@spirit:/tmp/bug$ git --no-pager diff
diff --git a/dir2/1.txt b/dir2/1.txt
deleted file mode 100644
index d00491f..0000000
--- a/dir2/1.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/dir2/2.txt b/dir2/2.txt
deleted file mode 100644
index b8a4cf4..0000000
--- a/dir2/2.txt
+++ /dev/null
@@ -1 +0,0 @@
-2b

-- 
Dennis Kaarsemaker
www.kaarsemaker.net

```
