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

bug in read-tree -m on A -> A/A

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 16, 2007, 04:19 UTC
Message-ID
<20070316041932.GA31606@spearce.org>

dancor on #git just noticed a bug in read-tree -m that prevents him from switching branches when the type of a path changes between a directory and a file. The following test appears to trigger the same failure, but I likely won't have time to fix it myself tonight. So if someone else gets a chance...

diff --git a/t/t9999-typechange.sh b/t/t9999-typechange.sh
new file mode 100755
index 0000000..dc92094
--- /dev/null
+++ b/t/t9999-typechange.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+test_description='switch branches over path typechange'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+	: >A &&
+	git-add A &&
+	tree1=$(git-write-tree) &&
+	comm1=$(echo A | git-commit-tree $tree1) &&
+	git-update-ref refs/heads/comm1 $comm1 &&
+	rm .git/index &&
+	rm -f A &&
+	mkdir A &&
+	echo : >A/A &&
+	git-add A/A &&
+	tree2=$(git-write-tree) &&
+	comm2=$(echo A/A | git-commit-tree $tree2) &&
+	git-update-ref HEAD $comm2
+'
+
+test_expect_success checkout 'git-checkout $comm1'
+
+test_done
-- 
Shawn.
Next: Junio C Hamano
Message 1 of 3 in “bug in read-tree -m on A -> A/A”
  1. Shawn O. PearceMar 16, 2007
  2. Junio C HamanoMar 16, 2007
  3. Junio C HamanoMar 16, 2007

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.