test case for 'got integrate' failing if symlink changes to file; patch by jrick This test verifies the current behaviour, even though it is not the most desirable behaviour.
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
diff --git a/regress/cmdline/integrate.sh b/regress/cmdline/integrate.sh
index 647ef62..c347b9e 100755
--- a/regress/cmdline/integrate.sh
+++ b/regress/cmdline/integrate.sh
@@ -385,8 +385,45 @@ test_integrate_backwards_in_time() {
test_done "$testroot" "$ret"
}
+test_integrate_obstructed_symlink() {
+ local testroot=`test_init update_replace_symlink`
+
+ got checkout $testroot/repo $testroot/wt > /dev/null
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ echo "checkout failed unexpectedly" >&2
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ (cd $testroot/wt && ln -s alpha alpha.link)
+ (cd $testroot/wt && got add alpha alpha.link >/dev/null)
+ (cd $testroot/wt && got commit -m "add regular file and symlink" \
+ >/dev/null)
+
+ (cd $testroot/wt && got br replace_symlink >/dev/null)
+ (cd $testroot/wt && rm alpha.link >/dev/null)
+ (cd $testroot/wt && cp alpha alpha.link)
+ (cd $testroot/wt && got stage alpha.link >/dev/null)
+ (cd $testroot/wt && got commit -m "replace symlink" >/dev/null)
+
+ (cd $testroot/wt && got up -b master >/dev/null)
+ (cd $testroot/wt && got integrate replace_symlink \
+ 2> $testroot/stderr)
+
+ echo "got: $testroot/wt/alpha.link: file is obstructed" \
+ > $testroot/stderr.expected
+ cmp -s $testroot/stderr.expected $testroot/stderr
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stderr.expected $testroot/stderr
+ fi
+ test_done "$testroot" "$ret"
+}
+
test_parseargs "$@"
run_test test_integrate_basic
run_test test_integrate_requires_rebase_first
run_test test_integrate_path_prefix
run_test test_integrate_backwards_in_time
+run_test test_integrate_obstructed_symlink