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>
33 files changed:
raw | patch | inline | side by side (parent: 7984f23 )
memcpy(header.name, path, pathlen);
if (S_ISREG(mode) && !args->convert &&
memcpy(header.name, path, pathlen);
if (S_ISREG(mode) && !args->convert &&
- sha1_object_info(oid->hash , &size) == OBJ_BLOB &&
+ oid_object_info(oid , &size) == OBJ_BLOB &&
size > big_file_threshold)
buffer = NULL;
else if (S_ISLNK(mode) || S_ISREG(mode)) {
size > big_file_threshold)
buffer = NULL;
else if (S_ISLNK(mode) || S_ISREG(mode)) {
compressed_size = 0;
buffer = NULL;
} else if (S_ISREG(mode) || S_ISLNK(mode)) {
compressed_size = 0;
buffer = NULL;
} else if (S_ISREG(mode) || S_ISLNK(mode)) {
- enum object_type type = sha1_object_info(oid->hash , &size);
+ enum object_type type = oid_object_info(oid , &size);
method = 0;
attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :
method = 0;
attr2 = S_ISLNK(mode) ? ((mode | 0777) << 16) :
unsigned mode;
if (!get_tree_entry(commit_oid->hash, path, blob_oid.hash, &mode) &&
unsigned mode;
if (!get_tree_entry(commit_oid->hash, path, blob_oid.hash, &mode) &&
- sha1_object_info(blob_oid.hash , NULL) == OBJ_BLOB)
+ oid_object_info(&blob_oid , NULL) == OBJ_BLOB)
origin->path,
origin->blob_oid.hash, &origin->mode))
goto error_out;
origin->path,
origin->blob_oid.hash, &origin->mode))
goto error_out;
- if (sha1_object_info(origin->blob_oid.hash , NULL) != OBJ_BLOB)
+ if (oid_object_info(&origin->blob_oid , NULL) != OBJ_BLOB)
goto error_out;
return 0;
error_out:
goto error_out;
return 0;
error_out:
if (get_oid(name, &oid))
return 0;
if (get_oid(name, &oid))
return 0;
- return OBJ_NONE < sha1_object_info(oid.hash , NULL);
+ return OBJ_NONE < oid_object_info(&oid , NULL);
}
int cmd_blame(int argc, const char **argv, const char *prefix)
}
int cmd_blame(int argc, const char **argv, const char *prefix)
switch (opt) {
case 't':
oi.type_name = &sb;
switch (opt) {
case 't':
oi.type_name = &sb;
- if (sha1_object_info_extended(oid.hash , &oi, flags) < 0)
+ if (oid_object_info_extended(&oid , &oi, flags) < 0)
die("git cat-file: could not get object info");
if (sb.len) {
printf("%s\n", sb.buf);
die("git cat-file: could not get object info");
if (sb.len) {
printf("%s\n", sb.buf);
case 's':
oi.sizep = &size;
case 's':
oi.sizep = &size;
- if (sha1_object_info_extended(oid.hash , &oi, flags) < 0)
+ if (oid_object_info_extended(&oid , &oi, flags) < 0)
die("git cat-file: could not get object info");
printf("%lu\n", size);
return 0;
die("git cat-file: could not get object info");
printf("%lu\n", size);
return 0;
/* else fallthrough */
case 'p':
/* else fallthrough */
case 'p':
- type = sha1_object_info(oid.hash , NULL);
+ type = oid_object_info(&oid , NULL);
if (type < 0)
die("Not a valid object name %s", obj_name);
if (type < 0)
die("Not a valid object name %s", obj_name);
case 0:
if (type_from_string(exp_type) == OBJ_BLOB) {
struct object_id blob_oid;
case 0:
if (type_from_string(exp_type) == OBJ_BLOB) {
struct object_id blob_oid;
- if (sha1_object_info(oid.hash , NULL) == OBJ_TAG) {
+ if (oid_object_info(&oid , NULL) == OBJ_TAG) {
char *buffer = read_sha1_file(oid.hash, &type, &size);
const char *target;
if (!skip_prefix(buffer, "object ", &target) ||
char *buffer = read_sha1_file(oid.hash, &type, &size);
const char *target;
if (!skip_prefix(buffer, "object ", &target) ||
} else
oidcpy(&blob_oid, &oid);
} else
oidcpy(&blob_oid, &oid);
- if (sha1_object_info(blob_oid.hash , NULL) == OBJ_BLOB)
+ if (oid_object_info(&blob_oid , NULL) == OBJ_BLOB)
return stream_blob_to_fd(1, &blob_oid, NULL, 0);
/*
* we attempted to dereference a tag to a blob
return stream_blob_to_fd(1, &blob_oid, NULL, 0);
/*
* we attempted to dereference a tag to a blob
struct strbuf buf = STRBUF_INIT;
if (!data->skip_object_info &&
struct strbuf buf = STRBUF_INIT;
if (!data->skip_object_info &&
- sha1_object_info_extended(data->oid.hash , &data->info,
- OBJECT_INFO_LOOKUP_REPLACE) < 0) {
+ oid_object_info_extended(&data->oid , &data->info,
+ OBJECT_INFO_LOOKUP_REPLACE) < 0) {
printf("%s missing\n",
obj_name ? obj_name : oid_to_hex(&data->oid));
fflush(stdout);
printf("%s missing\n",
obj_name ? obj_name : oid_to_hex(&data->oid));
fflush(stdout);
if (cmit)
describe_commit(&oid, &sb);
if (cmit)
describe_commit(&oid, &sb);
- else if (sha1_object_info(oid.hash , NULL) == OBJ_BLOB)
+ else if (oid_object_info(&oid , NULL) == OBJ_BLOB)
describe_blob(oid, &sb);
else
die(_("%s is neither a commit nor blob"), arg);
describe_blob(oid, &sb);
else
die(_("%s is neither a commit nor blob"), arg);
if (last_idnum < mark)
last_idnum = mark;
if (last_idnum < mark)
last_idnum = mark;
- type = sha1_object_info(oid.hash , NULL);
+ type = oid_object_info(&oid , NULL);
if (type < 0)
die("object not found: %s", oid_to_hex(&oid));
if (type < 0)
die("object not found: %s", oid_to_hex(&oid));
struct branch *current_branch = branch_get(NULL);
const char *pretty_ref = prettify_refname(ref->name);
struct branch *current_branch = branch_get(NULL);
const char *pretty_ref = prettify_refname(ref->name);
- type = sha1_object_info(ref->new_oid.hash , NULL);
+ type = oid_object_info(&ref->new_oid , NULL);
if (type < 0)
die(_("object %s not found"), oid_to_hex(&ref->new_oid));
if (type < 0)
die(_("object %s not found"), oid_to_hex(&ref->new_oid));
const char *ret;
if (obj->type == OBJ_NONE) {
const char *ret;
if (obj->type == OBJ_NONE) {
- enum object_type type = sha1_object_info(obj->oid.hash , NULL);
+ enum object_type type = oid_object_info(&obj->oid , NULL);
if (type > 0)
object_as_type(obj, type, 0);
}
if (type > 0)
object_as_type(obj, type, 0);
}
if (!(obj->flags & FLAG_CHECKED)) {
unsigned long size;
if (!(obj->flags & FLAG_CHECKED)) {
unsigned long size;
- int type = sha1_object_info(obj->oid.hash , &size);
+ int type = oid_object_info(&obj->oid , &size);
if (type <= 0)
die(_("did not receive expected object %s"),
oid_to_hex(&obj->oid));
if (type <= 0)
die(_("did not receive expected object %s"),
oid_to_hex(&obj->oid));
enum object_type has_type;
unsigned long has_size;
read_lock();
enum object_type has_type;
unsigned long has_size;
read_lock();
- has_type = sha1_object_info(oid->hash , &has_size);
+ has_type = oid_object_info(oid , &has_size);
if (has_type < 0)
die(_("cannot read existing object info %s"), oid_to_hex(oid));
if (has_type != type || has_size != size)
if (has_type < 0)
die(_("cannot read existing object info %s"), oid_to_hex(oid));
if (has_type != type || has_size != size)
char size_text[24];
if (!strcmp(type, blob_type)) {
unsigned long size;
char size_text[24];
if (!strcmp(type, blob_type)) {
unsigned long size;
- if (sha1_object_info(oid->hash , &size) == OBJ_BAD)
+ if (oid_object_info(oid , &size) == OBJ_BAD)
xsnprintf(size_text, sizeof(size_text),
"BAD");
else
xsnprintf(size_text, sizeof(size_text),
"BAD");
else
}
/* Check the type of object identified by sha1 */
}
/* Check the type of object identified by sha1 */
- obj_type = sha1_object_info(oid.hash , NULL);
+ obj_type = oid_object_info(&oid , NULL);
if (obj_type < 0) {
if (allow_missing) {
; /* no problem - missing objects are presumed to be of the right type */
if (obj_type < 0) {
if (allow_missing) {
; /* no problem - missing objects are presumed to be of the right type */
- entry->type = sha1_object_info(entry->idx.oid.hash , &entry->size);
+ entry->type = oid_object_info(&entry->idx.oid , &entry->size);
/*
* The error condition is checked in prepare_pack(). This is
* to permit a missing preferred base object to be ignored
/*
* The error condition is checked in prepare_pack(). This is
* to permit a missing preferred base object to be ignored
* And if that fails, the error will be recorded in entry->type
* and dealt with in prepare_pack().
*/
* And if that fails, the error will be recorded in entry->type
* and dealt with in prepare_pack().
*/
- entry->type = sha1_object_info(entry->idx.oid.hash,
- &entry->size);
+ entry->type = oid_object_info(&entry->idx.oid, &entry->size);
static int add_loose_object(const struct object_id *oid, const char *path,
void *data)
{
static int add_loose_object(const struct object_id *oid, const char *path,
void *data)
{
- enum object_type type = sha1_object_info(oid->hash , NULL);
+ enum object_type type = oid_object_info(oid , NULL);
if (type < 0) {
warning("loose object at %s could not be examined", path);
if (type < 0) {
warning("loose object at %s could not be examined", path);
if (st.st_mtime > expire)
return 0;
if (show_only || verbose) {
if (st.st_mtime > expire)
return 0;
if (show_only || verbose) {
- enum object_type type = sha1_object_info(oid->hash , NULL);
+ enum object_type type = oid_object_info(oid , NULL);
printf("%s %s\n", oid_to_hex(oid),
(type > 0) ? type_name(type) : "unknown");
}
printf("%s %s\n", oid_to_hex(oid),
(type > 0) ? type_name(type) : "unknown");
}
if (get_oid(refname, &object))
return error("Failed to resolve '%s' as a valid ref.", refname);
if (get_oid(refname, &object))
return error("Failed to resolve '%s' as a valid ref.", refname);
- obj_type = sha1_object_info(object.hash , NULL);
- repl_type = sha1_object_info(oid->hash , NULL);
+ obj_type = oid_object_info(&object , NULL);
+ repl_type = oid_object_info(oid , NULL);
printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
oid_to_hex(oid), type_name(repl_type));
printf("%s (%s) -> %s (%s)\n", refname, type_name(obj_type),
oid_to_hex(oid), type_name(repl_type));
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;
- obj_type = sha1_object_info(object->hash , NULL);
- repl_type = sha1_object_info(repl->hash , NULL);
+ obj_type = oid_object_info(object , NULL);
+ repl_type = oid_object_info(repl , NULL);
if (!force && obj_type != repl_type)
die("Objects must be of the same type.\n"
"'%s' points to a replaced object of type '%s'\n"
if (!force && obj_type != repl_type)
die("Objects must be of the same type.\n"
"'%s' points to a replaced object of type '%s'\n"
if (get_oid(object_ref, &old_oid) < 0)
die("Not a valid object name: '%s'", object_ref);
if (get_oid(object_ref, &old_oid) < 0)
die("Not a valid object name: '%s'", object_ref);
- type = sha1_object_info(old_oid.hash , NULL);
+ type = oid_object_info(&old_oid , NULL);
if (type < 0)
die("unable to get object type for %s", oid_to_hex(&old_oid));
if (type < 0)
die("unable to get object type for %s", oid_to_hex(&old_oid));
struct strbuf header = STRBUF_INIT;
char *path = NULL;
struct strbuf header = STRBUF_INIT;
char *path = NULL;
- type = sha1_object_info(object->hash , NULL);
+ type = oid_object_info(object , NULL);
if (type <= OBJ_NONE)
die(_("bad object type."));
if (type <= OBJ_NONE)
die(_("bad object type."));
}
strbuf_addstr(sb, " (");
}
strbuf_addstr(sb, " (");
- type = sha1_object_info(oid->hash , NULL);
+ type = oid_object_info(oid , NULL);
switch (type) {
default:
strbuf_addstr(sb, "object of unknown type");
switch (type) {
default:
strbuf_addstr(sb, "object of unknown type");
if (!(obj->flags & FLAG_OPEN)) {
unsigned long size;
if (!(obj->flags & FLAG_OPEN)) {
unsigned long size;
- int type = sha1_object_info(obj->oid.hash , &size);
+ int type = oid_object_info(&obj->oid , &size);
if (type != obj->type || type <= 0)
die("object of unexpected type");
obj->flags |= FLAG_WRITTEN;
if (type != obj->type || type <= 0)
die("object of unexpected type");
obj->flags |= FLAG_WRITTEN;
return do_lookup_replace_object(sha1);
}
return do_lookup_replace_object(sha1);
}
-/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
-extern int sha1_object_info(const unsigned char *, unsigned long *);
+/* Read and unpack an object file into memory, write memory to an object file */
+extern int oid_object_info(const struct object_id *, unsigned long *);
extern int hash_object_file(const void *buf, unsigned long len,
const char *type, struct object_id *oid);
extern int hash_object_file(const void *buf, unsigned long len,
const char *type, struct object_id *oid);
#define OBJECT_INFO_SKIP_CACHED 4
/* Do not retry packed storage after checking packed and loose storage */
#define OBJECT_INFO_QUICK 8
#define OBJECT_INFO_SKIP_CACHED 4
/* Do not retry packed storage after checking packed and loose storage */
#define OBJECT_INFO_QUICK 8
-extern int sha1_object_info_extended(const unsigned char *, struct object_info *, unsigned flags);
+extern int oid_object_info_extended(const struct object_id *, struct object_info *, unsigned flags);
/*
* Set this to 0 to prevent sha1_object_info_extended() from fetching missing
/*
* Set this to 0 to prevent sha1_object_info_extended() from fetching missing
else {
enum object_type type;
if (size_only || (flags & CHECK_BINARY)) {
else {
enum object_type type;
if (size_only || (flags & CHECK_BINARY)) {
- type = sha1_object_info(s->oid.hash , &s->size);
+ type = oid_object_info(&s->oid , &s->size);
if (type < 0)
die("unable to read %s",
oid_to_hex(&s->oid));
if (type < 0)
die("unable to read %s",
oid_to_hex(&s->oid));
die("corrupt mark line: %s", line);
e = find_object(&oid);
if (!e) {
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);
if (type < 0)
die("object not found: %s", oid_to_hex(&oid));
e = insert_object(&oid);
enum object_type expected = S_ISDIR(mode) ?
OBJ_TREE: OBJ_BLOB;
enum object_type type = oe ? oe->type :
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",
if (type < 0)
die("%s not found: %s",
S_ISDIR(mode) ? "Tree" : "Blob",
die("Not a blob (actually a %s): %s",
type_name(oe->type), command_buf.buf);
} else if (!is_null_oid(&oid)) {
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)
if (type < 0)
die("Blob not found: %s", command_buf.buf);
if (type != OBJ_BLOB)
} else if (!get_oid(from, &oid)) {
struct object_entry *oe = find_object(&oid);
if (!oe) {
} 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
if (type < 0)
die("Not a valid object: %s", from);
} else
unsigned long size;
char *buf = NULL;
if (!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! */
if (type < 0)
die("object not found: %s", oid_to_hex(oid));
/* cache it! */
assert(obj->type == OBJ_BLOB);
assert((obj->flags & SEEN) == 0);
assert(obj->type == OBJ_BLOB);
assert((obj->flags & SEEN) == 0);
- t = sha1_object_info(obj->oid.hash , &object_length);
+ t = oid_object_info(&obj->oid , &object_length);
if (t != OBJ_BLOB) { /* probably OBJ_NONE */
/*
* We DO NOT have the blob locally, so we cannot
if (t != OBJ_BLOB) { /* probably OBJ_NONE */
/*
* We DO NOT have the blob locally, so we cannot
if ((obj && obj->type == OBJ_BLOB && has_object_file(oid)) ||
(!obj && has_object_file(oid) &&
if ((obj && obj->type == OBJ_BLOB && has_object_file(oid)) ||
(!obj && has_object_file(oid) &&
- sha1_object_info(oid->hash , NULL) == OBJ_BLOB)) {
+ oid_object_info(oid , NULL) == OBJ_BLOB)) {
struct object_id reploid;
hashcpy(reploid.hash, repl);
struct object_id reploid;
hashcpy(reploid.hash, repl);
- real_type = sha1_object_info(entry->idx.oid.hash,
- NULL);
+ real_type = oid_object_info(&entry->idx.oid, NULL);
return OBJ_BAD;
nth_packed_object_oid(&oid, p, revidx->nr);
mark_bad_packed_object(p, oid.hash);
return OBJ_BAD;
nth_packed_object_oid(&oid, p, revidx->nr);
mark_bad_packed_object(p, oid.hash);
- type = sha1_object_info(oid.hash , NULL);
+ type = oid_object_info(&oid , NULL);
if (type <= OBJ_NONE)
return OBJ_BAD;
return type;
if (type <= OBJ_NONE)
return OBJ_BAD;
return type;
oi.sizep = size;
oi.contentp = &content;
oi.sizep = size;
oi.contentp = &content;
- if (sha1_object_info_extended(oid->hash , &oi, 0) < 0)
+ if (oid_object_info_extended(oid , &oi, 0) < 0)
return NULL;
return content;
}
return NULL;
return content;
}
* later processing, and the revision machinery expects
* commits and tags to have been parsed.
*/
* later processing, and the revision machinery expects
* commits and tags to have been parsed.
*/
- type = sha1_object_info(oid->hash , NULL);
+ type = oid_object_info(oid , NULL);
if (type < 0)
die("unable to get object info for %s", oid_to_hex(oid));
if (type < 0)
die("unable to get object info for %s", oid_to_hex(oid));
struct object *o = lookup_unknown_object(name->hash);
if (o->type == OBJ_NONE) {
struct object *o = lookup_unknown_object(name->hash);
if (o->type == OBJ_NONE) {
- int type = sha1_object_info(name->hash , NULL);
+ int type = oid_object_info(name , NULL);
if (type < 0 || !object_as_type(o, type, 0))
return PEEL_INVALID;
}
if (type < 0 || !object_as_type(o, type, 0))
return PEEL_INVALID;
}
continue; /* not a tag */
if (string_list_has_string(&dst_tag, ref->name))
continue; /* they already have it */
continue; /* not a tag */
if (string_list_has_string(&dst_tag, ref->name))
continue; /* they already have it */
- if (sha1_object_info(ref->new_oid.hash , NULL) != OBJ_TAG)
+ if (oid_object_info(&ref->new_oid , NULL) != OBJ_TAG)
continue; /* be conservative */
item = string_list_append(&src_tag, ref->name);
item->util = ref;
continue; /* be conservative */
item = string_list_append(&src_tag, ref->name);
item->util = ref;
if (!get_oid(name, &oid)) {
if (!lookup_commit_reference_gently(&oid, 1)) {
if (!get_oid(name, &oid)) {
if (!lookup_commit_reference_gently(&oid, 1)) {
- enum object_type type = sha1_object_info(oid.hash, NULL);
+ enum object_type type = oid_object_info(&oid,
+ NULL);
return error(_("%s: can't cherry-pick a %s"),
name, type_name(type));
}
return error(_("%s: can't cherry-pick a %s"),
name, type_name(type));
}
int fetch_if_missing = 1;
int fetch_if_missing = 1;
-int sha1_object_info_extended(const unsigned char *sha1 , struct object_info *oi, unsigned flags)
+int oid_object_info_extended(const struct object_id *oid , struct object_info *oi, unsigned flags)
{
static struct object_info blank_oi = OBJECT_INFO_INIT;
struct pack_entry e;
int rtype;
const unsigned char *real = (flags & OBJECT_INFO_LOOKUP_REPLACE) ?
{
static struct object_info blank_oi = OBJECT_INFO_INIT;
struct pack_entry e;
int rtype;
const unsigned char *real = (flags & OBJECT_INFO_LOOKUP_REPLACE) ?
- lookup_replace_object(sha1 ) :
- sha1 ;
+ lookup_replace_object(oid->hash ) :
+ oid->hash ;
int already_retried = 0;
struct object_id realoid;
int already_retried = 0;
struct object_id realoid;
rtype = packed_object_info(e.p, e.offset, oi);
if (rtype < 0) {
mark_bad_packed_object(e.p, real);
rtype = packed_object_info(e.p, e.offset, oi);
if (rtype < 0) {
mark_bad_packed_object(e.p, real);
- return sha1_object_info_extended(realoid.hash , oi, 0);
+ return oid_object_info_extended(&realoid , oi, 0);
} else if (oi->whence == OI_PACKED) {
oi->u.packed.offset = e.offset;
oi->u.packed.pack = e.p;
} else if (oi->whence == OI_PACKED) {
oi->u.packed.offset = e.offset;
oi->u.packed.pack = e.p;
}
/* returns enum object_type or negative */
}
/* returns enum object_type or negative */
-int sha1_object_info(const unsigned char *sha1 , unsigned long *sizep)
+int oid_object_info(const struct object_id *oid , unsigned long *sizep)
{
enum object_type type;
struct object_info oi = OBJECT_INFO_INIT;
oi.typep = &type;
oi.sizep = sizep;
{
enum object_type type;
struct object_info oi = OBJECT_INFO_INIT;
oi.typep = &type;
oi.sizep = sizep;
- if (sha1_object_info_extended(sha1 , &oi,
- OBJECT_INFO_LOOKUP_REPLACE) < 0)
+ if (oid_object_info_extended(oid , &oi,
+ OBJECT_INFO_LOOKUP_REPLACE) < 0)
return -1;
return type;
}
return -1;
return type;
}
- if (sha1_object_info_extended(oid.hash , &oi, 0) < 0)
+ if (oid_object_info_extended(&oid , &oi, 0) < 0)
return NULL;
return content;
}
return NULL;
return content;
}
if (!startup_info->have_repository)
return 0;
hashcpy(oid.hash, sha1);
if (!startup_info->have_repository)
return 0;
hashcpy(oid.hash, sha1);
- return sha1_object_info_extended(oid.hash , NULL,
- flags | OBJECT_INFO_SKIP_CACHED) >= 0;
+ return oid_object_info_extended(&oid , NULL,
+ flags | OBJECT_INFO_SKIP_CACHED) >= 0;
}
int has_object_file(const struct object_id *oid)
}
int has_object_file(const struct object_id *oid)
void assert_oid_type(const struct object_id *oid, enum object_type expect)
{
void assert_oid_type(const struct object_id *oid, enum object_type expect)
{
- enum object_type type = sha1_object_info(oid->hash , NULL);
+ enum object_type type = oid_object_info(oid , NULL);
if (type < 0)
die("%s is not a valid object", oid_to_hex(oid));
if (type != expect)
if (type < 0)
die("%s is not a valid object", oid_to_hex(oid));
if (type != expect)
static int disambiguate_commit_only(const struct object_id *oid, void *cb_data_unused)
{
static int disambiguate_commit_only(const struct object_id *oid, void *cb_data_unused)
{
- int kind = sha1_object_info(oid->hash , NULL);
+ int kind = oid_object_info(oid , NULL);
return kind == OBJ_COMMIT;
}
return kind == OBJ_COMMIT;
}
struct object *obj;
int kind;
struct object *obj;
int kind;
- kind = sha1_object_info(oid->hash , NULL);
+ kind = oid_object_info(oid , NULL);
if (kind == OBJ_COMMIT)
return 1;
if (kind != OBJ_TAG)
if (kind == OBJ_COMMIT)
return 1;
if (kind != OBJ_TAG)
static int disambiguate_tree_only(const struct object_id *oid, void *cb_data_unused)
{
static int disambiguate_tree_only(const struct object_id *oid, void *cb_data_unused)
{
- int kind = sha1_object_info(oid->hash , NULL);
+ int kind = oid_object_info(oid , NULL);
return kind == OBJ_TREE;
}
return kind == OBJ_TREE;
}
struct object *obj;
int kind;
struct object *obj;
int kind;
- kind = sha1_object_info(oid->hash , NULL);
+ kind = oid_object_info(oid , NULL);
if (kind == OBJ_TREE || kind == OBJ_COMMIT)
return 1;
if (kind != OBJ_TAG)
if (kind == OBJ_TREE || kind == OBJ_COMMIT)
return 1;
if (kind != OBJ_TAG)
static int disambiguate_blob_only(const struct object_id *oid, void *cb_data_unused)
{
static int disambiguate_blob_only(const struct object_id *oid, void *cb_data_unused)
{
- int kind = sha1_object_info(oid->hash , NULL);
+ int kind = oid_object_info(oid , NULL);
return kind == OBJ_BLOB;
}
return kind == OBJ_BLOB;
}
if (ds->fn && !ds->fn(oid, ds->cb_data))
return 0;
if (ds->fn && !ds->fn(oid, ds->cb_data))
return 0;
- type = sha1_object_info(oid->hash , NULL);
+ type = oid_object_info(oid , NULL);
if (type == OBJ_COMMIT) {
struct commit *commit = lookup_commit(oid);
if (commit) {
if (type == OBJ_COMMIT) {
struct commit *commit = lookup_commit(oid);
if (commit) {
oi->typep = type;
oi->sizep = &size;
oi->typep = type;
oi->sizep = &size;
- status = sha1_object_info_extended(oid.hash , oi, 0);
+ status = oid_object_info_extended(&oid , oi, 0);
if (status < 0)
return stream_error;
if (status < 0)
return stream_error;
{
struct has_commit_data *cb = data;
{
struct has_commit_data *cb = data;
- enum object_type type = sha1_object_info(oid->hash , NULL);
+ enum object_type type = oid_object_info(oid , NULL);
switch (type) {
case OBJ_COMMIT:
switch (type) {
case OBJ_COMMIT:
unsigned long size;
int ret;
unsigned long size;
int ret;
- type = sha1_object_info(oid->hash , NULL);
+ type = oid_object_info(oid , NULL);
if (type != OBJ_TAG)
return error("%s: cannot verify a non-tag object of type %s.",
name_to_report ?
if (type != OBJ_TAG)
return error("%s: cannot verify a non-tag object of type %s.",
name_to_report ?