diff options
Diffstat (limited to 'builtin/prune.c')
-rw-r--r-- | builtin/prune.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/builtin/prune.c b/builtin/prune.c index df376b2..57fe314 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -1,13 +1,20 @@ -#include "cache.h" +#include "builtin.h" #include "commit.h" #include "diff.h" +#include "dir.h" +#include "environment.h" +#include "gettext.h" +#include "hex.h" #include "revision.h" -#include "builtin.h" #include "reachable.h" #include "parse-options.h" +#include "path.h" #include "progress.h" #include "prune-packed.h" -#include "object-store.h" +#include "replace-object.h" +#include "object-file.h" +#include "object-name.h" +#include "object-store-ll.h" #include "shallow.h" static const char * const prune_usage[] = { @@ -98,7 +105,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath, return 0; } -static int prune_cruft(const char *basename, const char *path, void *data) +static int prune_cruft(const char *basename, const char *path, + void *data UNUSED) { if (starts_with(basename, "tmp_obj_")) prune_tmp_file(path); @@ -107,7 +115,8 @@ static int prune_cruft(const char *basename, const char *path, void *data) return 0; } -static int prune_subdir(unsigned int nr, const char *path, void *data) +static int prune_subdir(unsigned int nr UNUSED, const char *path, + void *data UNUSED) { if (!show_only) rmdir(path); @@ -127,7 +136,9 @@ static void remove_temporary_files(const char *path) dir = opendir(path); if (!dir) { - fprintf(stderr, "Unable to open directory %s\n", path); + if (errno != ENOENT) + fprintf(stderr, "Unable to open directory %s: %s\n", + path, strerror(errno)); return; } while ((de = readdir(dir)) != NULL) @@ -154,7 +165,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix) expire = TIME_MAX; save_commit_buffer = 0; - read_replace_refs = 0; + disable_replace_refs(); repo_init_revisions(the_repository, &revs, prefix); argc = parse_options(argc, argv, prefix, options, prune_usage, 0); @@ -166,7 +177,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix) struct object_id oid; const char *name = *argv++; - if (!get_oid(name, &oid)) { + if (!repo_get_oid(the_repository, name, &oid)) { struct object *object = parse_object_or_die(&oid, name); add_pending_object(&revs, object, ""); |