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

untracked symlinks are less precious than untracked files?

From
Johannes Sixt <j6t@kdbg.org>
Date
Feb 2, 2011, 19:25 UTC
Message-ID
<201102022025.06140.j6t@kdbg.org>
While I was poking around in t6035-merge-dir-to-symlink.sh, I noticed this:
diff --git a/t/t6035-merge-dir-to-symlink.sh b/t/t6035-merge-dir-to-symlink.sh
index 92e02d5..46b401b 100755
--- a/t/t6035-merge-dir-to-symlink.sh
+++ b/t/t6035-merge-dir-to-symlink.sh
@@ -5,21 +5,22 @@ test_description='merging when a directory was replaced with 
a symlink'
 
 test_expect_success SYMLINKS 'create a commit where dir a/b changed to 
symlink' '
 	mkdir -p a/b/c a/b-2/c &&
 	> a/b/c/d &&
 	> a/b-2/c/d &&
 	> a/x &&
 	git add -A &&
 	git commit -m base &&
 	git tag start &&
 	rm -rf a/b &&
-	ln -s b-2 a/b &&
+	# ln -s b-2 a/b &&
+	>a/b &&
 	git add -A &&
 	git commit -m "dir to symlink"
 '
 
 test_expect_success SYMLINKS 'keep a/b-2/c/d across checkout' '
 	git checkout HEAD^0 &&
 	git reset --hard master &&
 	git rm --cached a/b &&
 	git commit -m "untracked symlink remains" &&
 	 git checkout start^0 &&

With this change, where a symlink is replaced by a regular file, the 'git 
checkout start^0' fails. At this time, a/b is untracked. When it is a 
symlink, it is replaced by a directory. When it is a file, the test fails:

error: The following untracked working tree files would be overwritten by 
checkout:
        a/b

Is it by design that symlinks are less precious than files, or is it an 
oversight?

-- Hannes
Next: Junio C Hamano
Message 1 of 14 in “untracked symlinks are less precious than untracked files?”
  1. Johannes SixtFeb 2, 2011
  2. Junio C HamanoFeb 2, 2011
  3. Johannes SixtFeb 2, 2011
  4. Demonstrate breakage: checkout overwrites untracked symlink with directoryJohannes Sixt, Feb 5, 2011
  5. Clemens BuchacherFeb 5, 2011
  6. Junio C HamanoFeb 9, 2011
  7. Clemens BuchacherFeb 10, 2011
  8. do not overwrite untracked symlinksClemens Buchacher, Feb 20, 2011
  9. Junio C HamanoFeb 21, 2011
  10. Clemens BuchacherFeb 21, 2011
  11. Junio C HamanoFeb 22, 2011
  12. Clemens BuchacherFeb 22, 2011
  13. Junio C HamanoFeb 22, 2011
  14. Johannes SixtFeb 15, 2011

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.