From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: しらいしななこ <nanako3@bluebottle.com>
Cc: GIT <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] Add tests for git-stash
Date: Sat, 30 Jun 2007 17:06:28 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0706301705490.4438@racer.site> (raw)
In-Reply-To: <200706300539.l5U5dHLh003989@mi1.bluebottle.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
In the current version of git-stash, the last test fails.
Basically, it tests if different changes to the file "file"
in the working directory and the index are reconstructed.
They are not (index changes are not there), but I think they
should be.
t/t3903-stash.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 55 insertions(+), 0 deletions(-)
create mode 100755 t/t3903-stash.sh
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
new file mode 100755
index 0000000..6d42373
--- /dev/null
+++ b/t/t3903-stash.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Johannes E Schindelin
+#
+
+test_description='Test git-stash'
+
+. ./test-lib.sh
+
+test_expect_success 'stash some dirty working directory' '
+ echo 1 > file &&
+ git add file &&
+ test_tick &&
+ git commit -m initial &&
+ echo 2 > file &&
+ git add file &&
+ echo 3 > file &&
+ test_tick &&
+ git stash &&
+ git diff-files --quiet &&
+ git diff-index --cached --quiet HEAD
+'
+
+cat > expect << EOF
+diff --git a/file b/file
+index 0cfbf08..00750ed 100644
+--- a/file
++++ b/file
+@@ -1 +1 @@
+-2
++3
+EOF
+
+test_expect_success 'parents of stash' '
+ test $(git rev-parse stash^) = $(git rev-parse HEAD) &&
+ git diff stash^2..stash > output &&
+ diff -u output expect
+'
+
+test_expect_success 'apply needs clean working directory' '
+ echo 4 > other-file &&
+ git add other-file &&
+ ! git stash apply
+'
+
+test_expect_success 'apply stashed changes' '
+ test_tick &&
+ git commit -m other-file &&
+ git stash apply &&
+ test 3 = $(cat file) &&
+ test 2 = $(git show :file) &&
+ test 1 = $(git show HEAD:file)
+'
+
+test_done
--
1.5.2.2.3249.g33841
prev parent reply other threads:[~2007-06-30 16:06 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-30 1:29 [PATCH (2nd try)] Add git-stash script しらいしななこ
2007-06-30 2:05 ` Johannes Schindelin
2007-06-30 5:37 ` [PATCH (3rd " しらいしななこ
2007-06-30 6:12 ` Jeff King
2007-06-30 6:25 ` Junio C Hamano
2007-06-30 15:41 ` Johannes Schindelin
2007-06-30 17:19 ` Junio C Hamano
2007-06-30 23:27 ` しらいしななこ
2007-06-30 15:44 ` [PATCH] Add a manual page for git-stash Johannes Schindelin
2007-06-30 16:38 ` Frank Lichtenheld
2007-06-30 17:48 ` Johannes Schindelin
2007-06-30 18:45 ` Frank Lichtenheld
2007-06-30 17:44 ` Junio C Hamano
2007-06-30 17:56 ` Johannes Schindelin
2007-06-30 18:13 ` Junio C Hamano
2007-06-30 18:44 ` Johannes Schindelin
2007-07-01 5:26 ` [PATCH] Document git-stash しらいしななこ
2007-07-01 6:48 ` Junio C Hamano
2007-07-01 8:07 ` Jeff King
2007-07-01 8:38 ` Junio C Hamano
2007-07-01 9:06 ` しらいしななこ
[not found] ` <200707010910.l619A23c027837@mi0.bluebottle.com>
2007-07-01 9:19 ` Jeff King
2007-07-01 21:39 ` Junio C Hamano
2007-07-02 4:08 ` Jeff King
2007-07-01 21:54 ` Junio C Hamano
2007-07-01 22:57 ` Johannes Schindelin
2007-07-02 4:10 ` Jeff King
2007-07-02 10:33 ` Johannes Schindelin
2007-07-02 10:44 ` [PATCH] git-stash: Make "save" the default operation again Johannes Schindelin
2007-07-02 11:00 ` Jeff King
2007-07-02 11:15 ` Johannes Schindelin
2007-07-02 23:11 ` Junio C Hamano
2007-07-01 5:20 ` [PATCH] Add a manual page for git-stash Junio C Hamano
2007-06-30 16:06 ` Johannes Schindelin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0706301705490.4438@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nanako3@bluebottle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).