sha1_file: convert sha1_object_info* to object_id
Convert sha1_object_info and sha1_object_info_extended to take pointers to struct object_id and rename them to use "oid" instead of "sha1" in their names. Update the declaration and definition and apply the following semantic patch, plus the standard object_id transforms: @@ expression E1, E2; @@ - sha1_object_info(E1.hash, E2) + oid_object_info(&E1, E2) @@ expression E1, E2; @@ - sha1_object_info(E1->hash, E2) + oid_object_info(E1, E2) @@ expression E1, E2, E3; @@ - sha1_object_info_extended(E1.hash, E2, E3) + oid_object_info_extended(&E1, E2, E3) @@ expression E1, E2, E3; @@ - sha1_object_info_extended(E1->hash, E2, E3) + oid_object_info_extended(E1, E2, E3) Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
7984f23833
commit
abef9020e3
@ -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",
|
||||
@ -2603,7 +2603,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)
|
||||
@ -2890,7 +2890,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
|
||||
@ -3048,7 +3048,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! */
|
||||
|
||||
Reference in New Issue
Block a user