summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-11-04 01:11:17 -0700
committerJunio C Hamano <gitster@pobox.com>2007-11-04 01:11:17 -0700
commite091653951ae516a923338874bfe550894cd1bc9 (patch)
treee9620973ebe58be7edfb13e5df57f8e7262ce851 /builtin-pack-objects.c
parent2dfffd3e09b2541b1bfcc840a65eac0251832175 (diff)
parent79814f425c00129dbdbdc3c99d04af52ccc58254 (diff)
downloadgit-e091653951ae516a923338874bfe550894cd1bc9.tar.gz
Merge branch 'np/pack'
* np/pack: pack-objects: get rid of an ugly cast make the pack index version configurable Conflicts: builtin-pack-objects.c
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 25ec65d0f0..545ece5da7 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -57,7 +57,7 @@ struct object_entry {
* nice "minimum seek" order.
*/
static struct object_entry *objects;
-static struct object_entry **written_list;
+static struct pack_idx_entry **written_list;
static uint32_t nr_objects, nr_alloc, nr_result, nr_written;
static int non_empty;
@@ -577,7 +577,7 @@ static off_t write_one(struct sha1file *f,
e->idx.offset = 0;
return 0;
}
- written_list[nr_written++] = e;
+ written_list[nr_written++] = &e->idx;
/* make sure off_t is sufficiently large not to wrap */
if (offset > offset + size)
@@ -599,7 +599,7 @@ static void write_pack_file(void)
if (do_progress)
progress_state = start_progress("Writing objects", nr_result);
- written_list = xmalloc(nr_objects * sizeof(struct object_entry *));
+ written_list = xmalloc(nr_objects * sizeof(*written_list));
do {
unsigned char sha1[20];
@@ -651,9 +651,8 @@ static void write_pack_file(void)
umask(mode);
mode = 0444 & ~mode;
- idx_tmp_name = write_idx_file(NULL,
- (struct pack_idx_entry **) written_list,
- nr_written, sha1);
+ idx_tmp_name = write_idx_file(NULL, written_list,
+ nr_written, sha1);
snprintf(tmpname, sizeof(tmpname), "%s-%s.pack",
base_name, sha1_to_hex(sha1));
if (adjust_perm(pack_tmp_name, mode))
@@ -677,7 +676,7 @@ static void write_pack_file(void)
/* mark written objects as written to previous pack */
for (j = 0; j < nr_written; j++) {
- written_list[j]->idx.offset = (off_t)-1;
+ written_list[j]->offset = (off_t)-1;
}
nr_remaining -= nr_written;
} while (nr_remaining && i < nr_objects);
@@ -1768,6 +1767,12 @@ static int git_pack_config(const char *k, const char *v)
#endif
return 0;
}
+ if (!strcmp(k, "pack.indexversion")) {
+ pack_idx_default_version = git_config_int(k, v);
+ if (pack_idx_default_version > 2)
+ die("bad pack.indexversion=%d", pack_idx_default_version);
+ return 0;
+ }
return git_default_config(k, v);
}