* [PATCH 2/8] git-repack --max-pack-size: minor code restructuring
@ 2007-04-08 23:20 Dana How
0 siblings, 0 replies; only message in thread
From: Dana How @ 2007-04-08 23:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List, danahow
Move the call to write_index_file() from cmd_pack_objects()
to write_pack_file() (since only the latter will know how
many times to call write_index_file()), and move or add
forward declarations for later changes.
Signed-off-by: Dana How <how@deathvalley.cswitch.com>
---
builtin-pack-objects.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 64318b3..8415549 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -518,6 +518,16 @@ static off_t write_one(struct sha1file *f,
return offset + write_object(f, e);
}
+typedef int (*entry_sort_t)(const struct object_entry *, const struct object_entry *);
+
+static entry_sort_t current_sort;
+
+/* forward declarations for write_pack_file */
+/* (probably should move sorting stuff up here) */
+static int sort_comparator(const void *_a, const void *_b);
+static int sha1_sort(const struct object_entry *a, const struct object_entry *b);
+static void write_index_file(void);
+
static void write_pack_file(void)
{
uint32_t i;
@@ -562,6 +572,10 @@ static void write_pack_file(void)
if (written != nr_result)
die("wrote %u objects while expecting %u", written, nr_result);
sha1close(f, pack_file_sha1, 1);
+ if (!pack_to_stdout) {
+ write_index_file();
+ puts(sha1_to_hex(object_list_sha1));
+ }
}
static void write_index_file(void)
@@ -1106,10 +1120,6 @@ static void get_object_details(void)
}
}
-typedef int (*entry_sort_t)(const struct object_entry *, const struct object_entry *);
-
-static entry_sort_t current_sort;
-
static int sort_comparator(const void *_a, const void *_b)
{
struct object_entry *a = *(struct object_entry **)_a;
@@ -1698,10 +1708,6 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
progress_update = 0;
}
write_pack_file();
- if (!pack_to_stdout) {
- write_index_file();
- puts(sha1_to_hex(object_list_sha1));
- }
}
if (progress)
fprintf(stderr, "Total %u (delta %u), reused %u (delta %u)\n",
--
1.5.1.89.g8abf0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-04-08 23:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-08 23:20 [PATCH 2/8] git-repack --max-pack-size: minor code restructuring Dana How
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.