Code

Move --pretty options into Documentation/pretty-formats.txt
[git.git] / builtin-pack-objects.c
index 16e98f3f3f7303aaf613e4e17b317b2f6a975580..69e5dd39ca6f007d016ca562454cdb75ec9362fb 100644 (file)
 #include <sys/time.h>
 #include <signal.h>
 
-static const char pack_usage[] = "git-pack-objects [-q] [--no-reuse-delta] [--non-empty] [--local] [--incremental] [--window=N] [--depth=N] [--revs [--unpacked | --all]*] [--stdout | base-name] <ref-list | <object-list]";
+static const char pack_usage[] = "\
+git-pack-objects [{ -q | --progress | --all-progress }] \n\
+       [--local] [--incremental] [--window=N] [--depth=N] \n\
+       [--no-reuse-delta] [--delta-base-offset] [--non-empty] \n\
+       [--revs [--unpacked | --all]*] [--stdout | base-name] \n\
+       [<ref-list | <object-list]";
 
 struct object_entry {
        unsigned char sha1[20];
@@ -475,15 +480,15 @@ static void write_pack_file(void)
        unsigned long offset;
        struct pack_header hdr;
        unsigned last_percent = 999;
-       int do_progress = 0;
+       int do_progress = progress;
 
-       if (!base_name)
+       if (!base_name) {
                f = sha1fd(1, "<stdout>");
-       else {
+               do_progress >>= 1;
+       }
+       else
                f = sha1create("%s-%s.%s", base_name,
                               sha1_to_hex(object_list_sha1), "pack");
-               do_progress = progress;
-       }
        if (do_progress)
                fprintf(stderr, "Writing %d objects.\n", nr_result);
 
@@ -988,7 +993,7 @@ static void check_object(struct object_entry *entry)
                unuse_packed_git(p);
                entry->in_pack_header_size = used;
 
-               if (base_entry && !base_entry->preferred_base) {
+               if (base_entry) {
 
                        /* Depth value does not matter - find_deltas()
                         * will never consider reused delta as the
@@ -1520,10 +1525,6 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                        local = 1;
                        continue;
                }
-               if (!strcmp("--progress", arg)) {
-                       progress = 1;
-                       continue;
-               }
                if (!strcmp("--incremental", arg)) {
                        incremental = 1;
                        continue;
@@ -1546,6 +1547,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                        progress = 1;
                        continue;
                }
+               if (!strcmp("--all-progress", arg)) {
+                       progress = 2;
+                       continue;
+               }
                if (!strcmp("-q", arg)) {
                        progress = 0;
                        continue;
@@ -1641,7 +1646,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
        else {
                if (nr_result)
                        prepare_pack(window, depth);
-               if (progress && pack_to_stdout) {
+               if (progress == 1 && pack_to_stdout) {
                        /* the other end usually displays progress itself */
                        struct itimerval v = {{0,},};
                        setitimer(ITIMER_REAL, &v, NULL);