summaryrefslogtreecommitdiff
path: root/builtin/fast-import.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/fast-import.c')
-rw-r--r--builtin/fast-import.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 397a6f46ad..63880b595c 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -770,7 +770,7 @@ static void start_packfile(void)
p->pack_fd = pack_fd;
p->do_not_close = 1;
p->repo = the_repository;
- pack_file = hashfd(pack_fd, p->pack_name);
+ pack_file = hashfd(the_repository->hash_algo, pack_fd, p->pack_name);
pack_data = p;
pack_size = write_pack_header(pack_file, 0);
@@ -798,7 +798,7 @@ static const char *create_index(void)
if (c != last)
die("internal consistency error creating the index");
- tmpfile = write_idx_file(the_hash_algo, NULL, idx, object_count,
+ tmpfile = write_idx_file(the_repository, NULL, idx, object_count,
&pack_idx_opts, pack_data->hash);
free(idx);
return tmpfile;
@@ -2021,7 +2021,7 @@ static void parse_and_store_blob(
static struct strbuf buf = STRBUF_INIT;
uintmax_t len;
- if (parse_data(&buf, big_file_threshold, &len))
+ if (parse_data(&buf, repo_settings_get_big_file_threshold(the_repository), &len))
store_object(OBJ_BLOB, &buf, last, oidout, mark);
else {
if (last) {
@@ -2719,10 +2719,13 @@ static struct hash_list *parse_merge(unsigned int *count)
static void parse_new_commit(const char *arg)
{
+ static struct strbuf sig = STRBUF_INIT;
static struct strbuf msg = STRBUF_INIT;
+ struct string_list siglines = STRING_LIST_INIT_NODUP;
struct branch *b;
char *author = NULL;
char *committer = NULL;
+ char *sig_alg = NULL;
char *encoding = NULL;
struct hash_list *merge_list = NULL;
unsigned int merge_count;
@@ -2746,6 +2749,13 @@ static void parse_new_commit(const char *arg)
}
if (!committer)
die("Expected committer but didn't get one");
+ if (skip_prefix(command_buf.buf, "gpgsig ", &v)) {
+ sig_alg = xstrdup(v);
+ read_next_command();
+ parse_data(&sig, 0, NULL);
+ read_next_command();
+ } else
+ strbuf_setlen(&sig, 0);
if (skip_prefix(command_buf.buf, "encoding ", &v)) {
encoding = xstrdup(v);
read_next_command();
@@ -2819,10 +2829,23 @@ static void parse_new_commit(const char *arg)
strbuf_addf(&new_data,
"encoding %s\n",
encoding);
+ if (sig_alg) {
+ if (!strcmp(sig_alg, "sha1"))
+ strbuf_addstr(&new_data, "gpgsig ");
+ else if (!strcmp(sig_alg, "sha256"))
+ strbuf_addstr(&new_data, "gpgsig-sha256 ");
+ else
+ die("Expected gpgsig algorithm sha1 or sha256, got %s", sig_alg);
+ string_list_split_in_place(&siglines, sig.buf, "\n", -1);
+ strbuf_add_separated_string_list(&new_data, "\n ", &siglines);
+ strbuf_addch(&new_data, '\n');
+ }
strbuf_addch(&new_data, '\n');
strbuf_addbuf(&new_data, &msg);
+ string_list_clear(&siglines, 1);
free(author);
free(committer);
+ free(sig_alg);
free(encoding);
if (!store_object(OBJ_COMMIT, &new_data, NULL, &b->oid, next_mark))
@@ -3402,7 +3425,7 @@ static int parse_one_option(const char *option)
unsigned long v;
if (!git_parse_ulong(option, &v))
return 0;
- big_file_threshold = v;
+ repo_settings_set_big_file_threshold(the_repository, v);
} else if (skip_prefix(option, "depth=", &option)) {
option_depth(option);
} else if (skip_prefix(option, "active-branches=", &option)) {