Skip to contentSkip to conversation

stash-store: add failing test for same-ref

PATCH In review Phil Hord 2 participants 2 messages Nov 22, 2017 – Nov 24, 2017

lore
Share & tools
lore

Phil Hord

author
#0 lore raw

PATCH v2 2/2 stash-store: add failing test for same-ref

stash-store cannot create a new stash with the same ref as stash@{0}. No error is returned even though no new stash log is created. Add a failing test to track.

---
 t/t3903-stash.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
t/t3903-stash.sh +11 -0
index 279e31717..7d511afd3 100755
@@ -813,6 +813,17 @@ test_expect_success 'push -m also works without space' '
 	test_cmp expect actual
 '
 
+test_expect_failure 'store same ref twice' '
+	>foo &&
+	git add foo &&
+	STASH_ID=$(git stash create) &&
+	git stash store -m "original message" $STASH_ID &&
+	git stash store -m "custom message" $STASH_ID &&
+	echo "stash@{0}: custom message" >expect &&
+	git stash list -1 >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'store -m foo shows right message' '
 	>foo &&
 	git add foo &&
Signature · 1 line
2.15.0.471.g17a719cfe.dirty
#1 lore raw
Quoted 6 lines · Phil Hord

stash-store cannot create a new stash with the same ref as stash@{0}. No error is returned even though no new stash log is created. Add a failing test to track.

---

Sorry, I lost track. Where is v1 of this series and 1/2 of v2? IOW, where does this patch fit in in the larger picture?

Quoted 25 lines
 t/t3903-stash.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
t/t3903-stash.sh +11 -0
index 279e31717..7d511afd3 100755
@@ -813,6 +813,17 @@ test_expect_success 'push -m also works without space' '
 	test_cmp expect actual
 '
 
+test_expect_failure 'store same ref twice' '
+	>foo &&
+	git add foo &&
+	STASH_ID=$(git stash create) &&
+	git stash store -m "original message" $STASH_ID &&
+	git stash store -m "custom message" $STASH_ID &&
+	echo "stash@{0}: custom message" >expect &&
+	git stash list -1 >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'store -m foo shows right message' '
 	>foo &&
 	git add foo &&