untracked symlinks are less precious than untracked files?
From: Johannes Sixt <hidden>
Date: 2016-06-15 22:50:29
Subsystem:
the rest · Maintainer:
Linus Torvalds
While I was poking around in t6035-merge-dir-to-symlink.sh, I noticed this:
diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6035-merge-dir-to-symlink.sh
index 92e02d5..46b401b 100755
--- a/t/t6035-merge-dir-to-symlink.sh
+++ b/t/t6035-merge-dir-to-symlink.sh@@ -5,21 +5,22 @@ test_description='merging when a directory was replaced with a symlink'
test_expect_success SYMLINKS 'create a commit where dir a/b changed to
symlink' '
mkdir -p a/b/c a/b-2/c &&
> a/b/c/d &&
> a/b-2/c/d &&
> a/x &&
git add -A &&
git commit -m base &&
git tag start &&
rm -rf a/b &&
- ln -s b-2 a/b &&
+ # ln -s b-2 a/b &&
+ >a/b &&
git add -A &&
git commit -m "dir to symlink"
'
test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' '
git checkout HEAD^0 &&
git reset --hard master &&
git rm --cached a/b &&
git commit -m "untracked symlink remains" &&
git checkout start^0 &&
With this change, where a symlink is replaced by a regular file, the 'git
checkout start^0' fails. At this time, a/b is untracked. When it is a
symlink, it is replaced by a directory. When it is a file, the test fails:
error: The following untracked working tree files would be overwritten by
checkout:
a/b
Is it by design that symlinks are less precious than files, or is it an
oversight?
-- Hannes