From: Junio C Hamano <gitster@xxxxxxxxx> Date: Mon, 24 Mar 2008 23:20:51 -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@xxxxxxxxx> --- * This is done deliberately differently from what you did. Because we do not want to accept "we allow losing what's reachable from master" with "git prune master..next", setup_revisions() is not the right thing to use for this command. builtin-prune.c | 12 ++++++++++-- t/t5304-prune.sh | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/builtin-prune.c b/builtin-prune.c index 71caac5..ca50cca 100644 --- a/builtin-prune.c +++ b/builtin-prune.c @@ -140,8 +140,16 @@ int cmd_prune(int argc, const char **argv, const char *prefix) init_revisions(&revs, prefix); argc = parse_options(argc, argv, options, prune_usage, 0); - if (argc) - die ("unrecognized argument: %s", name); + while (argc--) { + struct object *object; + unsigned char sha1[20]; + const char *name = *argv++; + + if (!get_sha1(name, sha1) && (object = parse_object(sha1))) + 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 3d81e1f..9fd9d07 100644 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -100,7 +100,7 @@ test_expect_success 'prune: prune unreachable heads' ' ' -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 && -- 1.5.5.rc1.121.g1594 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html