summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-02-25 15:43:25 -0800
committerJunio C Hamano <gitster@pobox.com>2011-02-27 23:29:03 -0800
commitebcfb3791a53e0455bf8361046e3310993697a8e (patch)
treee9aa6131bcc77beab6d4a5f4665ab815e1f0fe5c /fast-import.c
parent7218a215efc7ae46f7ca8d82442f354e7ac06262 (diff)
downloadgit-ebcfb3791a53e0455bf8361046e3310993697a8e.tar.gz
write_idx_file: introduce a struct to hold idx customization options
Remove two globals, pack_idx_default version and pack_idx_off32_limit, and place them in a pack_idx_option structure. Allow callers to pass it to write_idx_file() as a parameter. Adjust all callers to the API change. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fast-import.c b/fast-import.c
index 3886a1b464..91e936d1b9 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -315,6 +315,7 @@ static unsigned int atom_cnt;
static struct atom_str **atom_table;
/* The .pack file being generated */
+static struct pack_idx_option pack_idx_opts;
static unsigned int pack_id;
static struct sha1file *pack_file;
static struct packed_git *pack_data;
@@ -905,7 +906,7 @@ static const char *create_index(void)
if (c != last)
die("internal consistency error creating the index");
- tmpfile = write_idx_file(NULL, idx, object_count, pack_data->sha1);
+ tmpfile = write_idx_file(NULL, idx, object_count, &pack_idx_opts, pack_data->sha1);
free(idx);
return tmpfile;
}
@@ -3055,10 +3056,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
return 0;
}
if (!strcmp(k, "pack.indexversion")) {
- pack_idx_default_version = git_config_int(k, v);
- if (pack_idx_default_version > 2)
+ pack_idx_opts.version = git_config_int(k, v);
+ if (pack_idx_opts.version > 2)
die("bad pack.indexversion=%"PRIu32,
- pack_idx_default_version);
+ pack_idx_opts.version);
return 0;
}
if (!strcmp(k, "pack.packsizelimit")) {
@@ -3116,6 +3117,7 @@ int main(int argc, const char **argv)
usage(fast_import_usage);
setup_git_directory();
+ reset_pack_idx_option(&pack_idx_opts);
git_config(git_pack_config, NULL);
if (!pack_compression_seen && core_compression_seen)
pack_compression_level = core_compression_level;