t/test-lib.sh: add test_external and test_external_without_stderr
[gitweb.git] / builtin-prune.c
index 71caac578d42e7153279ea94684c749ed9b78d0b..bd3d2f67f3eb54cedb1a6c18582c7e10aa3f7bc6 100644 (file)
@@ -140,12 +140,22 @@ 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--) {
+               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());
 
-       sync();
        prune_packed_objects(show_only);
        remove_temporary_files();
        return 0;