Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
ref-filter: convert some static functions to struct object_id
author
brian m. carlson
<sandals@crustytoothpaste.net>
Sat, 6 May 2017 22:10:22 +0000
(22:10 +0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 8 May 2017 06:12:58 +0000
(15:12 +0900)
Among the converted functions is a caller of parse_object_buffer, which
we will convert later.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
cedfc41
)
diff --git
a/ref-filter.c
b/ref-filter.c
index 77aee273f8091de33032f76b59cb2b351db58573..56fc990a5267e6d6d5c9d8e6cf1a6d02cc058120 100644
(file)
--- a/
ref-filter.c
+++ b/
ref-filter.c
@@
-677,13
+677,13
@@
int verify_ref_format(const char *format)
* by the "struct object" representation, set *eaten as well---it is a
* signal from parse_object_buffer to us not to free the buffer.
*/
* by the "struct object" representation, set *eaten as well---it is a
* signal from parse_object_buffer to us not to free the buffer.
*/
-static void *get_obj(const
unsigned char *sha1
, struct object **obj, unsigned long *sz, int *eaten)
+static void *get_obj(const
struct object_id *oid
, struct object **obj, unsigned long *sz, int *eaten)
{
enum object_type type;
{
enum object_type type;
- void *buf = read_sha1_file(
sha1
, &type, sz);
+ void *buf = read_sha1_file(
oid->hash
, &type, sz);
if (buf)
if (buf)
- *obj = parse_object_buffer(
sha1
, type, *sz, buf, eaten);
+ *obj = parse_object_buffer(
oid->hash
, type, *sz, buf, eaten);
else
*obj = NULL;
return buf;
else
*obj = NULL;
return buf;
@@
-1293,7
+1293,7
@@
static void populate_value(struct ref_array_item *ref)
struct object *obj;
int eaten, i;
unsigned long size;
struct object *obj;
int eaten, i;
unsigned long size;
- const
unsigned char
*tagged;
+ const
struct object_id
*tagged;
ref->value = xcalloc(used_atom_cnt, sizeof(struct atom_value));
ref->value = xcalloc(used_atom_cnt, sizeof(struct atom_value));
@@
-1370,10
+1370,10
@@
static void populate_value(struct ref_array_item *ref)
continue;
} else if (!strcmp(name, "HEAD")) {
const char *head;
continue;
} else if (!strcmp(name, "HEAD")) {
const char *head;
-
unsigned char sha1[20]
;
+
struct object_id oid
;
head = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
head = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
-
sha1
, NULL);
+
oid.hash
, NULL);
if (head && !strcmp(ref->refname, head))
v->s = "*";
else
if (head && !strcmp(ref->refname, head))
v->s = "*";
else
@@
-1415,7
+1415,7
@@
static void populate_value(struct ref_array_item *ref)
return;
need_obj:
return;
need_obj:
- buf = get_obj(
ref->objectname.hash
, &obj, &size, &eaten);
+ buf = get_obj(
&ref->objectname
, &obj, &size, &eaten);
if (!buf)
die(_("missing object %s for %s"),
oid_to_hex(&ref->objectname), ref->refname);
if (!buf)
die(_("missing object %s for %s"),
oid_to_hex(&ref->objectname), ref->refname);
@@
-1438,7
+1438,7
@@
static void populate_value(struct ref_array_item *ref)
* If it is a tag object, see if we use a value that derefs
* the object, and if we do grab the object it refers to.
*/
* If it is a tag object, see if we use a value that derefs
* the object, and if we do grab the object it refers to.
*/
- tagged =
((struct tag *)obj)->tagged->oid.hash
;
+ tagged =
&((struct tag *)obj)->tagged->oid
;
/*
* NEEDSWORK: This derefs tag only once, which
/*
* NEEDSWORK: This derefs tag only once, which
@@
-1449,10
+1449,10
@@
static void populate_value(struct ref_array_item *ref)
buf = get_obj(tagged, &obj, &size, &eaten);
if (!buf)
die(_("missing object %s for %s"),
buf = get_obj(tagged, &obj, &size, &eaten);
if (!buf)
die(_("missing object %s for %s"),
-
sha1
_to_hex(tagged), ref->refname);
+
oid
_to_hex(tagged), ref->refname);
if (!obj)
die(_("parse_object_buffer failed on %s for %s"),
if (!obj)
die(_("parse_object_buffer failed on %s for %s"),
-
sha1
_to_hex(tagged), ref->refname);
+
oid
_to_hex(tagged), ref->refname);
grab_values(ref->value, 1, obj, buf, size);
if (!eaten)
free(buf);
grab_values(ref->value, 1, obj, buf, size);
if (!eaten)
free(buf);