Skip to contentSkip to conversation

stash: fix false positive in the invalid ref test.

PATCH In review Jon Seymour 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stash: fix false positive in the invalid ref test.

Jeff King reported a problem with git stash apply incorrectly applying an invalid stash reference.

There is an existing test that should have caught this, but the test itself was broken, resulting in a false positive.

---
 t/t3903-stash.sh |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
t/t3903-stash.sh +5 -5
index 11077f0..5263de7 100755
@@ -543,11 +543,11 @@ test_expect_success 'invalid ref of the form stash@{n}, n >= N' '
 	echo bar6 > file2 &&
 	git add file2 &&
 	git stash &&
-	test_must_fail git drop stash@{1} &&
-	test_must_fail git pop stash@{1} &&
-	test_must_fail git apply stash@{1} &&
-	test_must_fail git show stash@{1} &&
-	test_must_fail git branch tmp stash@{1} &&
+	test_must_fail git stash drop stash@{1} &&
+	test_must_fail git stash pop stash@{1} &&
+	test_must_fail git stash apply stash@{1} &&
+	test_must_fail git stash show stash@{1} &&
+	test_must_fail git stash branch tmp stash@{1} &&
 	git stash drop
 '
 
Signature · 1 line
1.7.5.rc0.132.g4c19c
#1 lore raw
Quoted 9 lines · Jon Seymour
t/t3903-stash.sh +0 -1
index 11077f0..5263de7 100755
@@ -543,11 +543,11 @@ test_expect_success 'invalid ref of the form stash@{n}, n >= N' '
 	echo bar6 > file2 &&
 	git add file2 &&
 	git stash &&
-	test_must_fail git drop stash@{1} &&

t/t3903-stash.sh test_expect_success 'invalid ref of the form stash@{n}, n >= N' ' · line 551

Quoted 10 lines
t/t3903-stash.sh +5 -4
-	test_must_fail git pop stash@{1} &&
-	test_must_fail git apply stash@{1} &&
-	test_must_fail git show stash@{1} &&
-	test_must_fail git branch tmp stash@{1} &&
+	test_must_fail git stash drop stash@{1} &&
+	test_must_fail git stash pop stash@{1} &&
+	test_must_fail git stash apply stash@{1} &&
+	test_must_fail git stash show stash@{1} &&
+	test_must_fail git stash branch tmp stash@{1} &&
 	git stash drop

Probably we should just squash your fix in with my first patch, and drop my test. Your fixed version is a superset of what mine tests.

-Peff

#2 lore raw
Quoted 1 line · Jeff King

On Wed, Apr 06, 2011 at 09:21:13AM +1000, Jon Seymour wrote:

    git stash drop

Quoted 4 lines

Probably we should just squash your fix in with my first patch, and drop my test.  Your fixed version is a superset of what mine tests.

I was wondering if it might be better to break up the original test, so that each sub-function has its own invalid ref test? If there is agreement, I can do this on top of 9355fc which is the tip of the branch containing these fixes that has been merged into pu.

jon.

#3 lore raw
Quoted 4 lines · Jon Seymour
Quoted 1 line · Jeff King

On Wed, Apr 06, 2011 at 09:21:13AM +1000, Jon Seymour wrote:

    git stash drop

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

Probably we should just squash your fix in with my first patch, and drop my test.  Your fixed version is a superset of what mine tests.

I was wondering if it might be better to break up the original test, so that each sub-function has its own invalid ref test? If there is agreement, I can do this on top of 9355fc which is the tip of the branch containing these fixes that has been merged into pu.

I don't think it's that big a deal. You could do a more thorough test for each, I guess (to make sure they not just failed but also show that they didn't have any effects), but that would not be checking an actual regression we have seen. IOW, I'm sure you have something more productive to do with your time. :)

-Peff