t0302 & t3900: add forgotten quotes
[gitweb.git] / builtin / prune.c
index 10b03d3e4cb5ced78118251ac390dd6a33f9a71b..42633e0c6e672c46852f0590f1941249691f962c 100644 (file)
@@ -30,7 +30,7 @@ static int prune_tmp_file(const char *fullpath)
        return 0;
 }
 
-static int prune_object(const unsigned char *sha1, const char *fullpath,
+static int prune_object(const struct object_id *oid, const char *fullpath,
                        void *data)
 {
        struct stat st;
@@ -39,7 +39,7 @@ static int prune_object(const unsigned char *sha1, const char *fullpath,
         * Do we know about this object?
         * It must have been reachable
         */
-       if (lookup_object(sha1))
+       if (lookup_object(oid->hash))
                return 0;
 
        if (lstat(fullpath, &st)) {
@@ -50,8 +50,8 @@ static int prune_object(const unsigned char *sha1, const char *fullpath,
        if (st.st_mtime > expire)
                return 0;
        if (show_only || verbose) {
-               enum object_type type = sha1_object_info(sha1, NULL);
-               printf("%s %s\n", sha1_to_hex(sha1),
+               enum object_type type = sha1_object_info(oid->hash, NULL);
+               printf("%s %s\n", oid_to_hex(oid),
                       (type > 0) ? typename(type) : "unknown");
        }
        if (!show_only)
@@ -119,6 +119,9 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
 
        argc = parse_options(argc, argv, prefix, options, prune_usage, 0);
 
+       if (repository_format_precious_objects)
+               die(_("cannot prune in a precious-objects repo"));
+
        while (argc--) {
                unsigned char sha1[20];
                const char *name = *argv++;