pack-objects: clarification & option checks for --max-pack-size
Explain the special code for detecting a corner-case error, and complain about --stdout & --max-pack-size being used together. Signed-off-by: Dana L. How <danahow@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Dana How committed
May 23, 2007 at 10:11 UTC
01c12a23121780b7b1d84943fe310cf8773f8745
1 file changed
+9
builtin-pack-objects.c
+9
@@ -677,6 +677,12 @@ static void write_pack_file(void)
677
stop_progress(&progress_state);
678
if (written != nr_result)
679
die("wrote %u objects while expecting %u", written, nr_result);
680
+ /*
681
+ * We have scanned through [0 ... i). Since we have written
682
+ * the correct number of objects, the remaining [i ... nr_objects)
683
+ * items must be either already written (due to out-of-order delta base)
684
+ * or a preferred base. Count those which are neither and complain if any.
685
+ */
686
for (j = 0; i < nr_objects; i++) {
687
struct object_entry *e = objects + i;
688
j += !e->offset && !e->preferred_base;
@@ -1818,6 +1824,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
1824
if (pack_to_stdout != !base_name)
1825
usage(pack_usage);
1826
1827
+ if (pack_to_stdout && pack_size_limit)
1828
+ die("--max-pack-size cannot be used to build a pack for transfer.");
1829
+
1830
if (!pack_to_stdout && thin)
1831
die("--thin cannot be used to build an indexable pack.");
1832