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

[PATCH v3 09/13] object: introduce get_object_hash macro.

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Oct 9, 2015, 01:43 UTC
Message-ID
<1444355039-186351-10-git-send-email-sandals@crustytoothpaste.net>
In-Reply-To
<1444355039-186351-1-git-send-email-sandals@crustytoothpaste.net>

This macro is a temporary change to ease the transition of struct object to use struct object_id. It takes an argument of struct object and returns the object's hash. Provide this hash next to struct object for easier conversion.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 object.h | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/object.h b/object.h
index 6416247d..7c098d03 100644
--- a/object.h
+++ b/object.h
@@ -52,6 +52,8 @@ struct object {
 	unsigned char sha1[20];
 };
 
+#define get_object_hash(x) ((x).sha1)
+
 extern const char *typename(unsigned int type);
 extern int type_from_string_gently(const char *str, ssize_t, int gentle);
 #define type_from_string(str) type_from_string_gently(str, -1, 0)
-- 
2.6.1
Previous: brian m. carlsonNext: brian m. carlson
Message 12 of 16 in “object_id part 2”
  1. 00/13 object_id part 2brian m. carlson, Oct 9, 2015
  2. 01/13 refs: convert some internal functions to use object_idbrian m. carlson, Oct 9, 2015
  3. Michael HaggertyOct 13, 2015
  4. brian m. carlsonOct 14, 2015
  5. 02/13 sha1_file: introduce has_object_file helper.brian m. carlson, Oct 9, 2015
  6. 03/13 Convert struct ref to use object_id.brian m. carlson, Oct 9, 2015
  7. 04/13 add_sought_entry_mem: convert to struct object_idbrian m. carlson, Oct 9, 2015
  8. 05/13 parse_fetch: convert to use struct object_idbrian m. carlson, Oct 9, 2015
  9. 06/13 get_remote_heads: convert to struct object_idbrian m. carlson, Oct 9, 2015
  10. 07/13 push_refs_with_export: convert to struct object_idbrian m. carlson, Oct 9, 2015
  11. 08/13 ref_newer: convert to use struct object_idbrian m. carlson, Oct 9, 2015
  12. 09/13 object: introduce get_object_hash macro.brian m. carlson, Oct 9, 2015
  13. 10/13 Add several uses of get_object_hash.brian m. carlson, Oct 9, 2015
  14. 11/13 Convert struct object to object_idbrian m. carlson, Oct 9, 2015
  15. 12/13 Remove get_object_hash.brian m. carlson, Oct 9, 2015
  16. 13/13 remote: convert functions to struct object_idbrian m. carlson, Oct 9, 2015

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.