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

[PATCH v4 01/12] sha1_file: introduce has_object_file helper.

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Nov 10, 2015, 02:22 UTC
Message-ID
<1447122150-672570-2-git-send-email-sandals@crustytoothpaste.net>
In-Reply-To
<1447122150-672570-1-git-send-email-sandals@crustytoothpaste.net>

Add has_object_file, which is a wrapper around has_sha1_file, but for struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 cache.h     | 3 +++
 sha1_file.c | 5 +++++
 2 files changed, 8 insertions(+)
diff --git a/cache.h b/cache.h
index 3ba0b8f3..27bc121b 100644
--- a/cache.h
+++ b/cache.h
@@ -1030,6 +1030,9 @@ static inline int has_sha1_file(const unsigned char *sha1)
 	return has_sha1_file_with_flags(sha1, 0);
 }
 
+/* Same as the above, except for struct object_id. */
+extern int has_object_file(const struct object_id *oid);
+
 /*
  * Return true iff an alternate object database has a loose object
  * with the specified name.  This function does not respect replace
diff --git a/sha1_file.c b/sha1_file.c
index c5b31de9..59515b77 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -3227,6 +3227,11 @@ int has_sha1_file_with_flags(const unsigned char *sha1, int flags)
 	return find_pack_entry(sha1, &e);
 }
 
+int has_object_file(const struct object_id *oid)
+{
+	return has_sha1_file(oid->hash);
+}
+
 static void check_tree(const void *buf, size_t size)
 {
 	struct tree_desc desc;
-- 
2.6.2.409.gb049f0a
Previous: brian m. carlsonNext: brian m. carlson
Message 2 of 15 in “object_id part 2”
  1. 00/12 object_id part 2brian m. carlson, Nov 10, 2015
  2. 01/12 sha1_file: introduce has_object_file helper.brian m. carlson, Nov 10, 2015
  3. 02/12 Convert struct ref to use object_id.brian m. carlson, Nov 10, 2015
  4. 03/12 add_sought_entry_mem: convert to struct object_idbrian m. carlson, Nov 10, 2015
  5. 04/12 parse_fetch: convert to use struct object_idbrian m. carlson, Nov 10, 2015
  6. 05/12 get_remote_heads: convert to struct object_idbrian m. carlson, Nov 10, 2015
  7. 06/12 push_refs_with_export: convert to struct object_idbrian m. carlson, Nov 10, 2015
  8. 07/12 ref_newer: convert to use struct object_idbrian m. carlson, Nov 10, 2015
  9. 08/12 object: introduce get_object_hash macro.brian m. carlson, Nov 10, 2015
  10. 09/12 Add several uses of get_object_hash.brian m. carlson, Nov 10, 2015
  11. Jeff KingNov 20, 2015
  12. brian m. carlsonNov 20, 2015
  13. 10/12 Convert struct object to object_idbrian m. carlson, Nov 10, 2015
  14. 11/12 Remove get_object_hash.brian m. carlson, Nov 10, 2015
  15. 12/12 remote: convert functions to struct object_idbrian m. carlson, Nov 10, 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.