diff mbox series

[RFC,02/20] ref-filter: rename field in ref_array_item stuct

Message ID 0102016915f49a3c-5b22158a-2d4f-4611-9239-8388af61fd8f-000000@eu-west-1.amazonses.com (mailing list archive)
State New, archived
Headers show
Series [RFC,01/20] cat-file: reuse struct ref_format | expand

Commit Message

Olga Telezhnaya Feb. 22, 2019, 4:05 p.m. UTC
Rename objectname field to oid in struct ref_array_item.
We usually use objectname word for string representation
of object id, so oid explains the content better.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
---
 builtin/ls-remote.c | 2 +-
 ref-filter.c        | 8 ++++----
 ref-filter.h        | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)


--
https://github.com/git/git/pull/568

Comments

Jeff King Feb. 28, 2019, 9:06 p.m. UTC | #1
On Fri, Feb 22, 2019 at 04:05:45PM +0000, Olga Telezhnaya wrote:

> Rename objectname field to oid in struct ref_array_item.
> We usually use objectname word for string representation
> of object id, so oid explains the content better.

OK. I suspect the original was selected to match the %(objectname)
placeholder. But I agree that "oid" is the more common variable name,
and I think the connection between the placeholder and the variable
should be pretty clear.

-Peff
diff mbox series

Patch

diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 1d7f1f5ce2783..ce79aede726c7 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -143,7 +143,7 @@  int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		const struct ref_array_item *ref = ref_array.items[i];
 		if (show_symref_target && ref->symref)
 			printf("ref: %s\t%s\n", ref->symref, ref->refname);
-		printf("%s\t%s\n", oid_to_hex(&ref->objectname), ref->refname);
+		printf("%s\t%s\n", oid_to_hex(&ref->oid), ref->refname);
 		status = 0; /* we found something */
 	}
 
diff --git a/ref-filter.c b/ref-filter.c
index 422a9c9ae3fd2..736e1f9cc38fc 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1615,7 +1615,7 @@  static int populate_value(struct ref_array_item *ref, struct strbuf *err)
 				v->s = xstrdup(buf + 1);
 			}
 			continue;
-		} else if (!deref && grab_objectname(name, &ref->objectname, v, atom)) {
+		} else if (!deref && grab_objectname(name, &ref->oid, v, atom)) {
 			continue;
 		} else if (!strcmp(name, "HEAD")) {
 			if (atom->u.head && !strcmp(ref->refname, atom->u.head))
@@ -1661,7 +1661,7 @@  static int populate_value(struct ref_array_item *ref, struct strbuf *err)
 		struct atom_value *v = &ref->value[i];
 		if (v->s == NULL && used_atom[i].source == SOURCE_NONE)
 			return strbuf_addf_ret(err, -1, _("missing object %s for %s"),
-					       oid_to_hex(&ref->objectname), ref->refname);
+					       oid_to_hex(&ref->oid), ref->refname);
 	}
 
 	if (need_tagged)
@@ -1671,7 +1671,7 @@  static int populate_value(struct ref_array_item *ref, struct strbuf *err)
 		return 0;
 
 
-	oi.oid = ref->objectname;
+	oi.oid = ref->oid;
 	if (get_object(ref, 0, &obj, &oi, err))
 		return -1;
 
@@ -1898,7 +1898,7 @@  static struct ref_array_item *new_ref_array_item(const char *refname,
 	struct ref_array_item *ref;
 
 	FLEX_ALLOC_STR(ref, refname, refname);
-	oidcpy(&ref->objectname, oid);
+	oidcpy(&ref->oid, oid);
 
 	return ref;
 }
diff --git a/ref-filter.h b/ref-filter.h
index 85c8ebc3b904e..4d7d36e9f522d 100644
--- a/ref-filter.h
+++ b/ref-filter.h
@@ -34,7 +34,7 @@  struct ref_sorting {
 };
 
 struct ref_array_item {
-	struct object_id objectname;
+	struct object_id oid;
 	int flag;
 	unsigned int kind;
 	const char *symref;