git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add tests to catch problems with un-unlinkable symlinks

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 19, 2008, 04:59 UTC
Message-ID
<7v7ifz5mx0.fsf@gitster.siamese.dyndns.org>

This currently fails not because we refuse to check out, but because we detect error but incorrectly discard it in the callchain.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * The next one will fix it.
 t/t1004-read-tree-m-u-wf.sh |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh
index 283e77c..1356148 100755
--- a/t/t1004-read-tree-m-u-wf.sh
+++ b/t/t1004-read-tree-m-u-wf.sh
@@ -157,6 +157,41 @@ test_expect_success '3-way not overwriting local changes (their side)' '
 
 '
 
+test_expect_success 'funny symlink in work tree' '
+
+	git reset --hard &&
+	git checkout -b sym-b side-b &&
+	mkdir -p a &&
+	>a/b &&
+	git add a/b &&
+	git commit -m "side adds a/b" &&
+
+	rm -fr a &&
+	git checkout -b sym-a side-a &&
+	mkdir -p a &&
+	ln -s ../b a/b &&
+	git add a/b &&
+	git commit -m "we add a/b" &&
+
+	git read-tree -m -u sym-a sym-a sym-b
+
+'
+
+test_expect_failure 'funny symlink in work tree, un-unlink-able' '
+
+	rm -fr a b &&
+	git reset --hard &&
+
+	git checkout sym-a &&
+	chmod a-w a &&
+	test_must_fail git read-tree -m -u sym-a sym-a sym-b
+
+'
+
+# clean-up from the above test
+chmod a+w a
+rm -fr a b
+
 test_expect_success 'D/F setup' '
 
 	git reset --hard &&
-- 
1.5.5.rc0.122.g8e28f
Message 1 of 1 in “Add tests to catch problems with un-unlinkable symlinks”
  1. Add tests to catch problems with un-unlinkable symlinksJunio C Hamano, Mar 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.