git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Olga Telezhnaya <olyatelezhnaya@gmail.com>
Date
Feb 22, 2019, 16:05 UTC
Message-ID
<0102016915f49a3c-5b22158a-2d4f-4611-9239-8388af61fd8f-000000@eu-west-1.amazonses.com>
In-Reply-To
<0102016915f499b8-5813fc52-230b-469e-b939-a1244e83a2b9-000000@eu-west-1.amazonses.com>

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(-)
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;

--
https://github.com/git/git/pull/568
Previous: Jeff KingNext: Jeff King
Message 29 of 32 in “cat-file: reuse struct ref_format”
  1. 01/20 cat-file: reuse struct ref_formatOlga Telezhnaya, Feb 22, 2019
  2. 14/20 cat-file: move print_object_or_die to ref-filterOlga Telezhnaya, Feb 22, 2019
  3. 18/20 cat-file: get rid of expand_dataOlga Telezhnaya, Feb 22, 2019
  4. 08/20 cat-file: remove rest from expand_dataOlga Telezhnaya, Feb 22, 2019
  5. Jeff KingFeb 28, 2019
  6. 19/20 cat-file: tests for new atoms addedOlga Telezhnaya, Feb 22, 2019
  7. 17/20 cat-file: reuse ref-filter formatting logicOlga Telezhnaya, Feb 22, 2019
  8. 16/20 for-each-ref: tests for new atom %(raw) addedOlga Telezhnaya, Feb 22, 2019
  9. 20/20 cat-file: update docsOlga Telezhnaya, Feb 22, 2019
  10. 06/20 cat-file: remove mark_query from expand_dataOlga Telezhnaya, Feb 22, 2019
  11. Jeff KingFeb 28, 2019
  12. Christian CouderMar 3, 2019
  13. 03/20 ref-filter: add rest formatting optionOlga Telezhnaya, Feb 22, 2019
  14. Jeff KingFeb 28, 2019
  15. 13/20 cat-file: rewrite print_object_or_dieOlga Telezhnaya, Feb 22, 2019
  16. 09/20 ref-filter: make expand_data globalOlga Telezhnaya, Feb 22, 2019
  17. Jeff KingFeb 28, 2019
  18. 04/20 for-each-ref: tests for new atom %(rest) addedOlga Telezhnaya, Feb 22, 2019
  19. Jeff KingFeb 28, 2019
  20. Olga TelezhnayaMar 1, 2019
  21. 11/20 cat-file: move filter_object to diff.cOlga Telezhnaya, Feb 22, 2019
  22. 10/20 cat-file: inline stream_blobOlga Telezhnaya, Feb 22, 2019
  23. Jeff KingFeb 28, 2019
  24. 15/20 ref-filter: add raw formatting optionOlga Telezhnaya, Feb 22, 2019
  25. 07/20 cat-file: remove skip_object_infoOlga Telezhnaya, Feb 22, 2019
  26. Jeff KingFeb 28, 2019
  27. 05/20 cat-file: remove split_on_whitespaceOlga Telezhnaya, Feb 22, 2019
  28. Jeff KingFeb 28, 2019
  29. 02/20 ref-filter: rename field in ref_array_item stuctOlga Telezhnaya, Feb 22, 2019
  30. Jeff KingFeb 28, 2019
  31. 12/20 cat-file: remove batch_write functionOlga Telezhnaya, Feb 22, 2019
  32. Jeff KingFeb 28, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.