All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dennis Kaarsemaker <dennis@kaarsemaker.net>
To: NickKolok <nickkolok@mail.ru>
Cc: git@vger.kernel.org
Subject: Re: Bug report about symlinks
Date: Fri, 01 Aug 2014 21:10:59 +0200	[thread overview]
Message-ID: <1406920259.3253.7.camel@spirit> (raw)
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

  reply	other threads:[~2014-08-01 19:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30 11:30 Bug report about symlinks NickKolok
2014-08-01 19:10 ` Dennis Kaarsemaker [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-07-31 19:50 Nikolay Avdeev
2014-07-31 22:04 ` René Scharfe
2014-08-01 16:23   ` Junio C Hamano
2014-08-02 14:10     ` René Scharfe
2014-08-03 17:19       ` Junio C Hamano
2014-08-03 22:59         ` René Scharfe
2014-08-04 16:34           ` Junio C Hamano
2014-08-04 11:03         ` Duy Nguyen
2014-08-04 16:36           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406920259.3253.7.camel@spirit \
    --to=dennis@kaarsemaker.net \
    --cc=git@vger.kernel.org \
    --cc=nickkolok@mail.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.