Sync with 1.8.5.5
[gitweb.git] / builtin / prune.c
index 5bd3d199eb9df15618a59e0ca01901f8bc6839f6..de43b26cfe9c7610c13e3320bdac9fa2049e4db6 100644 (file)
@@ -81,7 +81,7 @@ static int prune_dir(int i, struct strbuf *path)
                        strbuf_setlen(path, baselen);
                        continue;
                }
-               if (!prefixcmp(de->d_name, "tmp_obj_")) {
+               if (starts_with(de->d_name, "tmp_obj_")) {
                        strbuf_addf(path, "/%s", de->d_name);
                        prune_tmp_file(path->buf);
                        strbuf_setlen(path, baselen);
@@ -129,7 +129,7 @@ static void remove_temporary_files(const char *path)
                return;
        }
        while ((de = readdir(dir)) != NULL)
-               if (!prefixcmp(de->d_name, "tmp_"))
+               if (starts_with(de->d_name, "tmp_"))
                        prune_tmp_file(mkpath("%s/%s", path, de->d_name));
        closedir(dir);
 }
@@ -180,5 +180,9 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
        s = mkpathdup("%s/pack", get_object_directory());
        remove_temporary_files(s);
        free(s);
+
+       if (is_repository_shallow())
+               prune_shallow(show_only);
+
        return 0;
 }