diff options
author | Clemens Buchacher <drizzd@aon.at> | 2011-02-20 13:13:43 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-02-21 22:51:07 -0800 |
commit | 1d718a5108f905e3c64f9fa791e67a52bd926457 (patch) | |
tree | 9871ac56854e4a1e983e390cd2c9f3a24beb0921 /t/t6035-merge-dir-to-symlink.sh | |
parent | 2fe26b775cfa298a0b4bc3c53011ca6da7c6c298 (diff) | |
download | git-1d718a5108f905e3c64f9fa791e67a52bd926457.tar.gz |
do not overwrite untracked symlinks
Git traditionally overwrites untracked symlinks silently. This will
generally not cause massive data loss, but it is inconsistent with
the behavior for regular files, which are not silently overwritten.
With this change, git refuses to overwrite untracked symlinks by
default. If the user really wants to overwrite the untracked
symlink, he has git-clean and git-checkout -f at his disposal.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6035-merge-dir-to-symlink.sh')
-rwxr-xr-x | t/t6035-merge-dir-to-symlink.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6035-merge-dir-to-symlink.sh index 92e02d5d77..2599ae50eb 100755 --- a/t/t6035-merge-dir-to-symlink.sh +++ b/t/t6035-merge-dir-to-symlink.sh @@ -17,13 +17,21 @@ test_expect_success SYMLINKS 'create a commit where dir a/b changed to symlink' git commit -m "dir to symlink" ' -test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' ' +test_expect_success SYMLINKS 'checkout does not clobber untracked symlink' ' git checkout HEAD^0 && git reset --hard master && git rm --cached a/b && git commit -m "untracked symlink remains" && - git checkout start^0 && - test -f a/b-2/c/d + test_must_fail git checkout start^0 +' + +test_expect_success SYMLINKS 'a/b-2/c/d is kept when clobbering symlink b' ' + git checkout HEAD^0 && + git reset --hard master && + git rm --cached a/b && + git commit -m "untracked symlink remains" && + git checkout -f start^0 && + test -f a/b-2/c/d ' test_expect_success SYMLINKS 'checkout should not have deleted a/b-2/c/d' ' |