Merge branch 'rd/man-prune-progress'
authorJunio C Hamano <gitster@pobox.com>
Wed, 6 Dec 2017 17:23:39 +0000 (09:23 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Dec 2017 17:23:39 +0000 (09:23 -0800)
Doc update.

* rd/man-prune-progress:
prune: add "--progress" to man page and usage msg

1  2 
builtin/prune.c
diff --combined builtin/prune.c
index cddabf26a95cc22dfcad9843554dc8af26c858bc,c2830d64e8d4c902ac552ebe0d5fcea5219368da..d2fdae680a1ebe75d55d4fb66a3bdd0b54829666
@@@ -8,12 -8,12 +8,12 @@@
  #include "progress.h"
  
  static const char * const prune_usage[] = {
-       N_("git prune [-n] [-v] [--expire <time>] [--] [<head>...]"),
+       N_("git prune [-n] [-v] [--progress] [--expire <time>] [--] [<head>...]"),
        NULL
  };
  static int show_only;
  static int verbose;
 -static unsigned long expire;
 +static timestamp_t expire;
  static int show_progress = -1;
  
  static int prune_tmp_file(const char *fullpath)
@@@ -30,7 -30,7 +30,7 @@@
        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 +39,7 @@@
         * 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 +50,8 @@@
        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)
@@@ -68,7 -68,7 +68,7 @@@ static int prune_cruft(const char *base
        return 0;
  }
  
 -static int prune_subdir(int nr, const char *path, void *data)
 +static int prune_subdir(unsigned int nr, const char *path, void *data)
  {
        if (!show_only)
                rmdir(path);
@@@ -111,7 -111,7 +111,7 @@@ int cmd_prune(int argc, const char **ar
        };
        char *s;
  
 -      expire = ULONG_MAX;
 +      expire = TIME_MAX;
        save_commit_buffer = 0;
        check_replace_refs = 0;
        ref_paranoia = 1;
                die(_("cannot prune in a precious-objects repo"));
  
        while (argc--) {
 -              unsigned char sha1[20];
 +              struct object_id oid;
                const char *name = *argv++;
  
 -              if (!get_sha1(name, sha1)) {
 -                      struct object *object = parse_object_or_die(sha1, name);
 +              if (!get_oid(name, &oid)) {
 +                      struct object *object = parse_object_or_die(&oid,
 +                                                                  name);
                        add_pending_object(&revs, object, "");
                }
                else
        if (show_progress == -1)
                show_progress = isatty(2);
        if (show_progress)
 -              progress = start_progress_delay(_("Checking connectivity"), 0, 0, 2);
 +              progress = start_delayed_progress(_("Checking connectivity"), 0);
  
        mark_reachable_objects(&revs, 1, expire, progress);
        stop_progress(&progress);