aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-07 22:34:26 -0800
committerJunio C Hamano <gitster@pobox.com>2008-03-07 22:34:26 -0800
commitd33046c1ed2182a4f73b741e47ab28b1570805c5 (patch)
tree36bb9474d82a6d8ec9a60a41065883af2dd1ce73 /t
parent5628a7a309e11c413138291b215a8cecedaddd24 (diff)
parentb683c08082d73484596dcf1236449228d4a9eb98 (diff)
downloadgit-d33046c1ed2182a4f73b741e47ab28b1570805c5.tar.gz
git-d33046c1ed2182a4f73b741e47ab28b1570805c5.tar.xz
Merge branch 'js/reflog-delete'
* js/reflog-delete: t3903-stash.sh: Add tests for new stash commands drop and pop git-reflog.txt: Document new commands --updateref and --rewrite t3903-stash.sh: Add missing '&&' to body of testcase git-stash: add new 'pop' subcommand git-stash: add new 'drop' subcommand git-reflog: add option --updateref to write the last reflog sha1 into the ref refs.c: make close_ref() and commit_ref() non-static git-reflog: add option --rewrite to update reflog entries while expiring reflog-delete: parse standard reflog options builtin-reflog.c: fix typo that accesses an unset variable Teach "git reflog" a subcommand to delete single entries
Diffstat (limited to 't')
-rwxr-xr-xt/t1410-reflog.sh27
-rwxr-xr-xt/t3903-stash.sh50
2 files changed, 74 insertions, 3 deletions
diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
index f959aae84..24476bede 100755
--- a/t/t1410-reflog.sh
+++ b/t/t1410-reflog.sh
@@ -175,6 +175,33 @@ test_expect_success 'recover and check' '
'
+test_expect_success 'delete' '
+ echo 1 > C &&
+ test_tick &&
+ git commit -m rat C &&
+
+ echo 2 > C &&
+ test_tick &&
+ git commit -m ox C &&
+
+ echo 3 > C &&
+ test_tick &&
+ git commit -m tiger C &&
+
+ test 5 = $(git reflog | wc -l) &&
+
+ git reflog delete master@{1} &&
+ git reflog show master > output &&
+ test 4 = $(wc -l < output) &&
+ ! grep ox < output &&
+
+ git reflog delete master@{07.04.2005.15:15:00.-0700} &&
+ git reflog show master > output &&
+ test 3 = $(wc -l < output) &&
+ ! grep dragon < output
+
+'
+
test_expect_success 'prune --expire' '
before=$(git count-objects | sed "s/ .*//") &&
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 9a9a250d2..aa282e1bc 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -40,8 +40,8 @@ test_expect_success 'parents of stash' '
test_expect_success 'apply needs clean working directory' '
echo 4 > other-file &&
git add other-file &&
- echo 5 > other-file
- ! git stash apply
+ echo 5 > other-file &&
+ test_must_fail git stash apply
'
test_expect_success 'apply stashed changes' '
@@ -70,7 +70,51 @@ test_expect_success 'unstashing in a subdirectory' '
git reset --hard HEAD &&
mkdir subdir &&
cd subdir &&
- git stash apply
+ git stash apply &&
+ cd ..
+'
+
+test_expect_success 'drop top stash' '
+ git reset --hard &&
+ git stash list > stashlist1 &&
+ echo 7 > file &&
+ git stash &&
+ git stash drop &&
+ git stash list > stashlist2 &&
+ diff stashlist1 stashlist2 &&
+ git stash apply &&
+ test 3 = $(cat file) &&
+ test 1 = $(git show :file) &&
+ test 1 = $(git show HEAD:file)
+'
+
+test_expect_success 'drop middle stash' '
+ git reset --hard &&
+ echo 8 > file &&
+ git stash &&
+ echo 9 > file &&
+ git stash &&
+ git stash drop stash@{1} &&
+ test 2 = $(git stash list | wc -l) &&
+ git stash apply &&
+ test 9 = $(cat file) &&
+ test 1 = $(git show :file) &&
+ test 1 = $(git show HEAD:file) &&
+ git reset --hard &&
+ git stash drop &&
+ git stash apply &&
+ test 3 = $(cat file) &&
+ test 1 = $(git show :file) &&
+ test 1 = $(git show HEAD:file)
+'
+
+test_expect_success 'stash pop' '
+ git reset --hard &&
+ git stash pop &&
+ test 3 = $(cat file) &&
+ test 1 = $(git show :file) &&
+ test 1 = $(git show HEAD:file) &&
+ test 0 = $(git stash list | wc -l)
'
test_done