restore unversioned file test case in test_cherrypick_symlink_conflicts One part of current behaviour is to delete an unversioned file and replace it with a symlink; that's very bad in case the user wants to keep the file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
diff --git a/regress/cmdline/cherrypick.sh b/regress/cmdline/cherrypick.sh
index 0c33fc4..0f28669 100755
--- a/regress/cmdline/cherrypick.sh
+++ b/regress/cmdline/cherrypick.sh
@@ -472,6 +472,7 @@ function test_cherrypick_symlink_conflicts {
local commit_id1=`git_show_head $testroot/repo`
(cd $testroot/repo && ln -sf beta alpha.link)
+ (cd $testroot/repo && ln -sf beta boo.link)
(cd $testroot/repo && ln -sfh gamma epsilon.link)
(cd $testroot/repo && ln -sf ../gamma/delta epsilon/beta.link)
echo 'this is regular file foo' > $testroot/repo/dotgotfoo.link
@@ -497,6 +498,8 @@ function test_cherrypick_symlink_conflicts {
# added bad symlink to file A vs added regular file A
echo 'this is regular file bar' > $testroot/wt/dotgotbar.link
(cd $testroot/wt && got add dotgotbar.link > /dev/null)
+ # added symlink to file A vs unversioned file A
+ echo 'this is unversioned file boo' > $testroot/wt/boo.link
# removed symlink to non-existent file A vs modified symlink
# to nonexistent file B
(cd $testroot/wt && ln -sf nonexistent2 nonexistent.link)
@@ -514,8 +517,10 @@ function test_cherrypick_symlink_conflicts {
echo -n > $testroot/stdout.expected
echo "C alpha.link" >> $testroot/stdout.expected
echo "C epsilon/beta.link" >> $testroot/stdout.expected
- echo "C dotgotbar.link" >> $testroot/stdout.expected
+ # TODO: This is wrong! Unversioned file boo.link should be preserved.
+ echo "U boo.link" >> $testroot/stdout.expected
echo "C epsilon.link" >> $testroot/stdout.expected
+ echo "C dotgotbar.link" >> $testroot/stdout.expected
echo "U dotgotfoo.link" >> $testroot/stdout.expected
echo "D nonexistent.link" >> $testroot/stdout.expected
echo "! zeta.link" >> $testroot/stdout.expected
@@ -563,6 +568,23 @@ EOF
return 1
fi
+ # TODO: This is wrong! Unversioned file boo.link should be preserved.
+ if [ ! -h $testroot/wt/boo.link ]; then
+ echo "boo.link is not a symlink"
+ test_done "$testroot" "1"
+ return 1
+ fi
+
+ echo "beta" > $testroot/content.expected
+ cp $testroot/wt/boo.link $testroot/content
+ cmp -s $testroot/content.expected $testroot/content
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/content.expected $testroot/content
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
if [ -h $testroot/wt/epsilon.link ]; then
echo "epsilon.link is a symlink"
test_done "$testroot" "1"