Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15
DORMANTno replies

[PATCH] Test that git add removes stages 1,2,3.

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:43:19
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Johannes Sixt <redacted>
---
git add seems to have a bug, where it doesn't remove stages 1,2,3
if a stage 0 entry is already in the index.

Here is a test (on top of maint) for the kind soul who wants to fix
this border case.  Feel free to merge this patch into your patch
that provides the fix.

-- Hannes

 t/t3700-add.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index ad8cc7d..d7dd6ca 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -110,4 +110,16 @@ test_expect_success 'check correct prefix detection' '
 	git add 1/2/a 1/3/b 1/2/c
 '
 
+test_expect_success 'git add removes unmerged entries' '
+	git rm --cached -f file &&
+	for s in 0 1 2 3
+	do
+		echo "100644 0123456789012345678901234567890123456789 $s	file"
+	done | git update-index --index-info &&
+	echo new > file &&
+	git add file &&
+	git ls-files --stage | grep "^100644 .* 0	file$" &&
+	! git ls-files --stage | grep "^100644 .* [^0]	file$"
+'
+
 test_done
-- 
1.5.2.2.555.g24e57
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help