Commit Diff


commit - 727173c3ab3a0b386e808d2d6bbeacd048710216
commit + 9314b9f4a55e5ebd1a98fa58bcd4e429e8b46163
blob - 647ef6246e563eb70ba0369e986910cd0842ad52
blob + c347b9ec6713d7f7eb5960370b109310af7802ba
--- regress/cmdline/integrate.sh
+++ regress/cmdline/integrate.sh
@@ -384,9 +384,46 @@ test_integrate_backwards_in_time() {
 	fi
 	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