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

[PATCH 1/2] t8006: Add test to show blame failure

From
BWBen Willard <benwillard@gmail.com>
Date
Jun 2, 2009, 19:28 UTC
Message-ID
<4a257d7b.1358560a.504d.47c3@mx.google.com>
In-Reply-To
<cover.1243969358.git.benwillard@gmail.com>

'git blame' fails on a file which was changed from a directory to a file in a single commit. This test shows the failure.

Signed-off-by: Ben Willard <benwillard@gmail.com>
---
 t/t8006-blame.sh |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
 create mode 100755 t/t8006-blame.sh
diff --git a/t/t8006-blame.sh b/t/t8006-blame.sh
new file mode 100755
index 0000000..7c271f0
--- /dev/null
+++ b/t/t8006-blame.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+test_description='git blame on file which changed from a directory to a file in the same commit'
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+	mkdir dir &&
+	touch dir/file &&
+	git add dir/file &&
+	git commit -m "Add dir/file" &&
+	git rm dir/file &&
+	echo "File contents" > dir &&
+	git add dir &&
+	git commit -m "Add dir as a file"
+'
+
+test_expect_failure 'blame runs on dir' '
+	git blame dir
+'
+
+test_done
-- 
1.6.3.1.279.gd4bf4
Previous: Ben WillardNext: Ben Willard
Message 2 of 5 in “git-blame bug”
  1. 0/2 git-blame bugBen Willard, Jun 2, 2009
  2. 1/2 t8006: Add test to show blame failureBen Willard, Jun 2, 2009
  3. 2/2 blame: Fix corner case when a directory becomes a fileBen Willard, Jun 2, 2009
  4. Junio C HamanoJun 3, 2009
  5. Ben WillardJun 3, 2009

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.