git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Test that git add removes stages 1,2,3.
@ 2007-07-02 11:18 Johannes Sixt
  2007-07-02 11:23 ` [PATCH/amend] " Johannes Sixt
  2007-07-02 11:34 ` [PATCH] " Johannes Schindelin
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Sixt @ 2007-07-02 11:18 UTC (permalink / raw)
  To: git, j.sixt; +Cc: Johannes Sixt

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH/amend] Test that git add removes stages 1,2,3.
  2007-07-02 11:18 [PATCH] Test that git add removes stages 1,2,3 Johannes Sixt
@ 2007-07-02 11:23 ` Johannes Sixt
  2007-07-02 11:34 ` [PATCH] " Johannes Schindelin
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2007-07-02 11:23 UTC (permalink / raw)
  To: git; +Cc: j.sixt, Johannes Sixt

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---

HMPF!

The test in the original post failed for the wrong reason. :-/

-- 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..06fc2bf 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 || : ignore failure &&
+	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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Test that git add removes stages 1,2,3.
  2007-07-02 11:18 [PATCH] Test that git add removes stages 1,2,3 Johannes Sixt
  2007-07-02 11:23 ` [PATCH/amend] " Johannes Sixt
@ 2007-07-02 11:34 ` Johannes Schindelin
  2007-07-02 11:47   ` Johannes Sixt
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2007-07-02 11:34 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git, j.sixt

Hi,

On Mon, 2 Jul 2007, Johannes Sixt wrote:

> 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.

But how does that happen? I do not know any way to use porcelain to 
achieve that bogus state.

AFAIK stages 1,2,3 are only populated when there are conflicts, in which 
case there is no stage 0. Literally the only way I see to have both is to 
_make_ update-index put them in there.

Pilot error?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Test that git add removes stages 1,2,3.
  2007-07-02 11:34 ` [PATCH] " Johannes Schindelin
@ 2007-07-02 11:47   ` Johannes Sixt
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Sixt @ 2007-07-02 11:47 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Johannes Sixt, git

Johannes Schindelin wrote:
> On Mon, 2 Jul 2007, Johannes Sixt wrote:
> 
> > 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.
> 
> But how does that happen? I do not know any way to use porcelain to
> achieve that bogus state.

I'm aware of that; so I said "border case" in the original post.

> Pilot error?

Oh, yes :) It noticed this when I was tweaking the test for git add with
symlinks=false that I posted.

-- Hannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-02 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-02 11:18 [PATCH] Test that git add removes stages 1,2,3 Johannes Sixt
2007-07-02 11:23 ` [PATCH/amend] " Johannes Sixt
2007-07-02 11:34 ` [PATCH] " Johannes Schindelin
2007-07-02 11:47   ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).