summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-04-09 23:25:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-09 23:25:45 (GMT)
commita5bbc29994b22ab0b57c4dc9568a261d32476e94 (patch)
tree4cf0247ad3bac3f8130f83a2f9b40197a24fab0f /fast-import.c
parent78c20b8fcaf0c46942a8c91e38076358f9a948ac (diff)
parent1a750441a7360b29fff7a414649ece1d35acaca6 (diff)
downloadgit-a5bbc29994b22ab0b57c4dc9568a261d32476e94.zip
git-a5bbc29994b22ab0b57c4dc9568a261d32476e94.tar.gz
git-a5bbc29994b22ab0b57c4dc9568a261d32476e94.tar.bz2
Merge branch 'bc/object-id'
Conversion from uchar[20] to struct object_id continues. * bc/object-id: (36 commits) convert: convert to struct object_id sha1_file: introduce a constant for max header length Convert lookup_replace_object to struct object_id sha1_file: convert read_sha1_file to struct object_id sha1_file: convert read_object_with_reference to object_id tree-walk: convert tree entry functions to object_id streaming: convert istream internals to struct object_id tree-walk: convert get_tree_entry_follow_symlinks internals to object_id builtin/notes: convert static functions to object_id builtin/fmt-merge-msg: convert remaining code to object_id sha1_file: convert sha1_object_info* to object_id Convert remaining callers of sha1_object_info_extended to object_id packfile: convert unpack_entry to struct object_id sha1_file: convert retry_bad_packed_offset to struct object_id sha1_file: convert assert_sha1_type to object_id builtin/mktree: convert to struct object_id streaming: convert open_istream to use struct object_id sha1_file: convert check_sha1_signature to struct object_id sha1_file: convert read_loose_object to use struct object_id builtin/index-pack: convert struct ref_delta_entry to object_id ...
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/fast-import.c b/fast-import.c
index b5db5d2..a2e8b1d 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1412,7 +1412,7 @@ static void load_tree(struct tree_entry *root)
die("Can't load tree %s", oid_to_hex(oid));
} else {
enum object_type type;
- buf = read_sha1_file(oid->hash, &type, &size);
+ buf = read_object_file(oid, &type, &size);
if (!buf || type != OBJ_TREE)
die("Can't load tree %s", oid_to_hex(oid));
}
@@ -1913,7 +1913,7 @@ static void read_marks(void)
die("corrupt mark line: %s", line);
e = find_object(&oid);
if (!e) {
- enum object_type type = sha1_object_info(oid.hash, NULL);
+ enum object_type type = oid_object_info(&oid, NULL);
if (type < 0)
die("object not found: %s", oid_to_hex(&oid));
e = insert_object(&oid);
@@ -2443,7 +2443,7 @@ static void file_change_m(const char *p, struct branch *b)
enum object_type expected = S_ISDIR(mode) ?
OBJ_TREE: OBJ_BLOB;
enum object_type type = oe ? oe->type :
- sha1_object_info(oid.hash, NULL);
+ oid_object_info(&oid, NULL);
if (type < 0)
die("%s not found: %s",
S_ISDIR(mode) ? "Tree" : "Blob",
@@ -2583,8 +2583,9 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
oidcpy(&commit_oid, &commit_oe->idx.oid);
} else if (!get_oid(p, &commit_oid)) {
unsigned long size;
- char *buf = read_object_with_reference(commit_oid.hash,
- commit_type, &size, commit_oid.hash);
+ char *buf = read_object_with_reference(&commit_oid,
+ commit_type, &size,
+ &commit_oid);
if (!buf || size < 46)
die("Not a valid commit: %s", p);
free(buf);
@@ -2603,7 +2604,7 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
die("Not a blob (actually a %s): %s",
type_name(oe->type), command_buf.buf);
} else if (!is_null_oid(&oid)) {
- enum object_type type = sha1_object_info(oid.hash, NULL);
+ enum object_type type = oid_object_info(&oid, NULL);
if (type < 0)
die("Blob not found: %s", command_buf.buf);
if (type != OBJ_BLOB)
@@ -2653,9 +2654,8 @@ static void parse_from_existing(struct branch *b)
unsigned long size;
char *buf;
- buf = read_object_with_reference(b->oid.hash,
- commit_type, &size,
- b->oid.hash);
+ buf = read_object_with_reference(&b->oid, commit_type, &size,
+ &b->oid);
parse_from_commit(b, buf, size);
free(buf);
}
@@ -2732,8 +2732,9 @@ static struct hash_list *parse_merge(unsigned int *count)
oidcpy(&n->oid, &oe->idx.oid);
} else if (!get_oid(from, &n->oid)) {
unsigned long size;
- char *buf = read_object_with_reference(n->oid.hash,
- commit_type, &size, n->oid.hash);
+ char *buf = read_object_with_reference(&n->oid,
+ commit_type,
+ &size, &n->oid);
if (!buf || size < 46)
die("Not a valid commit: %s", from);
free(buf);
@@ -2890,7 +2891,7 @@ static void parse_new_tag(const char *arg)
} else if (!get_oid(from, &oid)) {
struct object_entry *oe = find_object(&oid);
if (!oe) {
- type = sha1_object_info(oid.hash, NULL);
+ type = oid_object_info(&oid, NULL);
if (type < 0)
die("Not a valid object: %s", from);
} else
@@ -2966,7 +2967,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
char *buf;
if (!oe || oe->pack_id == MAX_PACK_ID) {
- buf = read_sha1_file(oid->hash, &type, &size);
+ buf = read_object_file(oid, &type, &size);
} else {
type = oe->type;
buf = gfi_unpack_entry(oe, &size);
@@ -3048,7 +3049,7 @@ static struct object_entry *dereference(struct object_entry *oe,
unsigned long size;
char *buf = NULL;
if (!oe) {
- enum object_type type = sha1_object_info(oid->hash, NULL);
+ enum object_type type = oid_object_info(oid, NULL);
if (type < 0)
die("object not found: %s", oid_to_hex(oid));
/* cache it! */
@@ -3071,7 +3072,7 @@ static struct object_entry *dereference(struct object_entry *oe,
buf = gfi_unpack_entry(oe, &size);
} else {
enum object_type unused;
- buf = read_sha1_file(oid->hash, &unused, &size);
+ buf = read_object_file(oid, &unused, &size);
}
if (!buf)
die("Can't load object %s", oid_to_hex(oid));