From: Junio C Hamano <junio@pobox.com>
To: Michele Ballabio <barra_cuda@katamail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: [PATCH 3/5] Add tests for git-prune
Date: Mon, 24 Mar 2008 23:59:31 -0700 [thread overview]
Message-ID: <7v63vbnvak.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 200803242218.44026.barra_cuda@katamail.com
From: Michele Ballabio <barra_cuda@katamail.com>
Date: Sun, 23 Mar 2008 22:34:34 +0100
It seems that git prune changed behaviour with respect to revisions added
from command line, probably when it became a builtin. Currently, it prints
a short usage and exits: instead, it should take those revisions into
account and not prune them. So add a couple of test to point this out.
We'll be fixing this by switching to parse_options(), so add tests to
detect bogus command line parameters as well, to keep ourselves from
introducing regressions.
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/t5304-prune.sh | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 47090c4..3d81e1f 100644
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
@@ -78,4 +78,38 @@ test_expect_success 'gc: start with ok gc.pruneExpire' '
'
+test_expect_success 'prune: prune nonsense parameters' '
+
+ test_must_fail git prune garbage &&
+ test_must_fail git prune --- &&
+ test_must_fail git prune --no-such-option
+
+'
+
+test_expect_success 'prune: prune unreachable heads' '
+
+ git config core.logAllRefUpdates false &&
+ mv .git/logs .git/logs.old &&
+ : > file2 &&
+ git add file2 &&
+ git commit -m temporary &&
+ tmp_head=$(git rev-list -1 HEAD) &&
+ git reset HEAD^ &&
+ git prune &&
+ test_must_fail git reset $tmp_head --
+
+'
+
+test_expect_failure 'prune: do not prune heads listed as an argument' '
+
+ : > file2 &&
+ git add file2 &&
+ git commit -m temporary &&
+ tmp_head=$(git rev-list -1 HEAD) &&
+ git reset HEAD^ &&
+ git prune -- $tmp_head &&
+ git reset $tmp_head --
+
+'
+
test_done
--
1.5.5.rc1.121.g1594
next prev parent reply other threads:[~2008-03-25 7:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-23 20:50 [PATCH 2/2] builtin-prune.c: fix object parsing and use parse_options() Michele Ballabio
2008-03-23 22:21 ` Johannes Schindelin
2008-03-24 12:31 ` Michele Ballabio
2008-03-24 13:13 ` Johannes Schindelin
2008-03-24 14:02 ` [PATCH 3/2] parse-options.c: introduce OPT_DATE Michele Ballabio
2008-03-24 13:59 ` Johannes Schindelin
2008-03-24 16:25 ` Michele Ballabio
2008-03-24 20:03 ` Johannes Schindelin
2008-03-24 20:10 ` Junio C Hamano
2008-03-24 21:18 ` Michele Ballabio
2008-03-25 6:58 ` Junio C Hamano
2008-03-25 6:59 ` [PATCH 1/5] " Junio C Hamano
2008-03-25 6:59 ` [PATCH 2/5] test_must_fail: 129 is a valid error code from usage() Junio C Hamano
2008-03-25 10:01 ` Johannes Schindelin
2008-03-25 11:21 ` Johannes Sixt
2008-03-25 19:27 ` Johannes Schindelin
2008-03-25 6:59 ` Junio C Hamano [this message]
2008-03-25 6:59 ` [PATCH 4/5] builtin-prune.c: use parse_options() Junio C Hamano
2008-03-25 6:59 ` [PATCH 5/5] builtin-prune: protect objects listed on the command line Junio C Hamano
2008-03-27 16:32 ` Junio C Hamano
2008-03-27 16:35 ` Johannes Schindelin
2008-03-27 21:11 ` Michele Ballabio
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=7v63vbnvak.fsf@gitster.siamese.dyndns.org \
--to=junio@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=barra_cuda@katamail.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.