summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 629de47)
raw | patch | inline | side by side (parent: 629de47)
author | Junio C Hamano <gitster@pobox.com> | |
Tue, 25 Mar 2008 06:20:51 +0000 (23:20 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 27 Mar 2008 22:39:57 +0000 (15:39 -0700) |
Finally, this resurrects the documented behaviour to protect other
objects listed on the command line from getting pruned.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
objects listed on the command line from getting pruned.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-prune.c | patch | blob | history | |
t/t5304-prune.sh | patch | blob | history |
diff --git a/builtin-prune.c b/builtin-prune.c
index 71caac578d42e7153279ea94684c749ed9b78d0b..25f9304b829c9074e8a034eba5e34c38794058a4 100644 (file)
--- a/builtin-prune.c
+++ b/builtin-prune.c
init_revisions(&revs, prefix);
argc = parse_options(argc, argv, options, prune_usage, 0);
- if (argc)
- die ("unrecognized argument: %s", name);
+ while (argc--) {
+ unsigned char sha1[20];
+ const char *name = *argv++;
+
+ if (!get_sha1(name, sha1)) {
+ struct object *object = parse_object(sha1);
+ if (!object)
+ die("bad object: %s", name);
+ add_pending_object(&revs, object, "");
+ }
+ else
+ die("unrecognized argument: %s", name);
+ }
mark_reachable_objects(&revs, 1);
prune_object_dir(get_object_directory());
diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh
index 3d81e1f19aa9d0b7e7d4ffbf4338d9048e8196c1..9fd9d0700033027921c90290cedc0a31d71c7733 100644 (file)
--- a/t/t5304-prune.sh
+++ b/t/t5304-prune.sh
'
-test_expect_failure 'prune: do not prune heads listed as an argument' '
+test_expect_success 'prune: do not prune heads listed as an argument' '
: > file2 &&
git add file2 &&