Merge branch 'jk/warn-on-object-refname-ambiguity'
[gitweb.git] / builtin / pack-objects.c
index 3f427b4e4ba35c2313c149903bb173c675a56e2d..0ee5f1ff94e1689b099f04fff8a05728c70f2f4f 100644 (file)
@@ -755,7 +755,7 @@ static void write_pack_file(void)
        struct object_entry **write_order;
 
        if (progress > pack_to_stdout)
-               progress_state = start_progress("Writing objects", nr_result);
+               progress_state = start_progress(_("Writing objects"), nr_result);
        written_list = xmalloc(to_pack.nr_objects * sizeof(*written_list));
        write_order = compute_write_order();
 
@@ -1210,12 +1210,9 @@ static int check_pbase_path(unsigned hash)
        if (0 <= pos)
                return 1;
        pos = -pos - 1;
-       if (done_pbase_paths_alloc <= done_pbase_paths_num) {
-               done_pbase_paths_alloc = alloc_nr(done_pbase_paths_alloc);
-               done_pbase_paths = xrealloc(done_pbase_paths,
-                                           done_pbase_paths_alloc *
-                                           sizeof(unsigned));
-       }
+       ALLOC_GROW(done_pbase_paths,
+                  done_pbase_paths_num + 1,
+                  done_pbase_paths_alloc);
        done_pbase_paths_num++;
        if (pos < done_pbase_paths_num)
                memmove(done_pbase_paths + pos + 1,
@@ -2151,7 +2148,7 @@ static void prepare_pack(int window, int depth)
        if (nr_deltas && n > 1) {
                unsigned nr_done = 0;
                if (progress)
-                       progress_state = start_progress("Compressing objects",
+                       progress_state = start_progress(_("Compressing objects"),
                                                        nr_deltas);
                qsort(delta_list, n, sizeof(*delta_list), type_size_sort);
                ll_find_deltas(delta_list, n, window+1, depth, &nr_done);
@@ -2452,6 +2449,9 @@ static void get_object_list(int ac, const char **av)
        save_commit_buffer = 0;
        setup_revisions(ac, av, &revs, NULL);
 
+       /* make sure shallows are read */
+       is_repository_shallow();
+
        while (fgets(line, sizeof(line), stdin) != NULL) {
                int len = strlen(line);
                if (len && line[len - 1] == '\n')
@@ -2464,6 +2464,13 @@ static void get_object_list(int ac, const char **av)
                                write_bitmap_index = 0;
                                continue;
                        }
+                       if (starts_with(line, "--shallow ")) {
+                               unsigned char sha1[20];
+                               if (get_sha1_hex(line + 10, sha1))
+                                       die("not an SHA-1 '%s'", line + 10);
+                               register_shallow(sha1);
+                               continue;
+                       }
                        die("not a rev '%s'", line);
                }
                if (handle_revision_arg(line, &revs, flags, REVARG_CANNOT_BE_FILENAME))
@@ -2609,7 +2616,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
                OPT_END(),
        };
 
-       read_replace_refs = 0;
+       check_replace_refs = 0;
 
        reset_pack_idx_option(&pack_idx_opts);
        git_config(git_pack_config, NULL);
@@ -2684,7 +2691,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
        prepare_packed_git();
 
        if (progress)
-               progress_state = start_progress("Counting objects", 0);
+               progress_state = start_progress(_("Counting objects"), 0);
        if (!use_internal_rev_list)
                read_object_list_from_stdin();
        else {