{"thread":{"id":"7535","subject":"[PATCH 06/13] small source reorderings to prepare for --pack-limit","startedAt":"2007-04-05T22:32:14Z","lastAt":"2007-04-05T22:32:14Z","messageCount":1,"participants":["Dana How"],"isPatch":true,"patchVersion":1,"patchTotal":13},"messages":[{"id":"38747","messageId":"56b7f5510704051532q15ac161am413fc5a3cdf1c93@mail.gmail.com","threadId":"7535","inReplyTo":null,"subject":"[PATCH 06/13] small source reorderings to prepare for --pack-limit","fromName":"Dana How","fromEmail":"danahow@gmail.com","sentAt":"2007-04-05T22:32:14Z","receivedAt":"2007-04-05T22:32:14Z","isPatch":true,"sender":{"key":"danahow@gmail.com","avatar":null},"body":"---\n builtin-pack-objects.c |   22 ++++++++++++++--------\n 1 files changed, 14 insertions(+), 8 deletions(-)\n\n-- \nDana L. How  danahow@gmail.com  +1 650 804 5991 cell\n\n\nFrom a18da16f22cb2888cad3d6ce6c55332865eebb25 Mon Sep 17 00:00:00 2001\nFrom: Dana How <how@deathvalley.cswitch.com>\nDate: Thu, 5 Apr 2007 13:47:53 -0700\nSubject: [PATCH 06/13] small source reorderings to prepare for --pack-limit\n\n---\n builtin-pack-objects.c |   22 ++++++++++++++--------\n 1 files changed, 14 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex 7da06a8..0a9deb0 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -519,6 +519,16 @@ static off_t write_one(struct sha1file *f,\n \treturn offset + write_object(f, e);\n }\n \n+typedef int (*entry_sort_t)(const struct object_entry *, const struct object_entry *);\n+\n+static entry_sort_t current_sort;\n+\n+/* forward declarations for write_pack_file */\n+/* (probably should move sorting stuff up here) */\n+static int sort_comparator(const void *_a, const void *_b);\n+static int sha1_sort(const struct object_entry *a, const struct object_entry *b);\n+static void write_index_file(void);\n+\n static void write_pack_file(void)\n {\n \tuint32_t i;\n@@ -563,6 +573,10 @@ static void write_pack_file(void)\n \tif (written != nr_result)\n \t\tdie(\"wrote %u objects while expecting %u\", written, nr_result);\n \tsha1close(f, pack_file_sha1, 1);\n+\tif (!pack_to_stdout) {\n+\t\twrite_index_file();\n+\t\tputs(sha1_to_hex(object_list_sha1));\n+\t}\n }\n \n static void write_index_file(void)\n@@ -1107,10 +1121,6 @@ static void get_object_details(void)\n \t}\n }\n \n-typedef int (*entry_sort_t)(const struct object_entry *, const struct object_entry *);\n-\n-static entry_sort_t current_sort;\n-\n static int sort_comparator(const void *_a, const void *_b)\n {\n \tstruct object_entry *a = *(struct object_entry **)_a;\n@@ -1699,10 +1709,6 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)\n \t\t\tprogress_update = 0;\n \t\t}\n \t\twrite_pack_file();\n-\t\tif (!pack_to_stdout) {\n-\t\t\twrite_index_file();\n-\t\t\tputs(sha1_to_hex(object_list_sha1));\n-\t\t}\n \t}\n \tif (progress)\n \t\tfprintf(stderr, \"Total %u (delta %u), reused %u (delta %u)\\n\",\n-- \n1.5.1.rc2.18.g9c88-dirty\n\n"}]}