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

[RFC PATCH 6/6] sha1-name: Add gentle alternative for `get_oid()`

From
Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Date
Jul 17, 2018, 12:06 UTC
Message-ID
<046f5f7a3495acbbb53ee2b7007d5c058f18cc0b.1531778417.git.ungureanupaulsebastian@gmail.com>
In-Reply-To
<cover.1531778417.git.ungureanupaulsebastian@gmail.com>
Add `get_oid_gently()` to be a gentle alternative to `get_oid()`.
Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
---
 cache.h     | 1 +
 sha1-name.c | 6 ++++++
 2 files changed, 7 insertions(+)
diff --git a/cache.h b/cache.h
index cb8803e2f..36e196202 100644
--- a/cache.h
+++ b/cache.h
@@ -1321,6 +1321,7 @@ struct object_context {
 	GET_OID_TREE | GET_OID_TREEISH | \
 	GET_OID_BLOB)
 
+extern int get_oid_gently(const char *str, struct object_id *oid);
 extern int get_oid(const char *str, struct object_id *oid);
 extern int get_oid_commit(const char *str, struct object_id *oid);
 extern int get_oid_committish(const char *str, struct object_id *oid);
diff --git a/sha1-name.c b/sha1-name.c
index a5d4e0dc7..6ee48fdf7 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -1474,6 +1474,12 @@ int get_oid(const char *name, struct object_id *oid)
 	return get_oid_with_context(name, 0, oid, &unused);
 }
 
+int get_oid_gently(const char *name, struct object_id *oid)
+{
+	struct object_context unused;
+	return get_oid_with_context(name, GET_OID_GENTLY, oid, &unused);
+}
+
 
 /*
  * Many callers know that the user meant to name a commit-ish by
-- 
2.18.0.rc2.184.ga79db55c2.dirty
Previous: Paul-Sebastian UngureanuNext: Paul-Sebastian Ungureanu
Message 5 of 13 in “Add gentle alternative for `get_oid()`”
  1. 0/6 Add gentle alternative for `get_oid()`Paul-Sebastian Ungureanu, Jul 17, 2018
  2. 5/6 sha1-name: Teach `get_oid_with_context[_1]()` to be gentlePaul-Sebastian Ungureanu, Jul 17, 2018
  3. Junio C HamanoJul 17, 2018
  4. Paul-Sebastian UngureanuJul 18, 2018
  5. 6/6 sha1-name: Add gentle alternative for `get_oid()`Paul-Sebastian Ungureanu, Jul 17, 2018
  6. 4/6 sha1-name: Teach `get_oid_basic()` to be gentlePaul-Sebastian Ungureanu, Jul 17, 2018
  7. 3/6 refs.c: Teach `read_ref_at()` to accept `GET_OID_GENTLY` flagPaul-Sebastian Ungureanu, Jul 17, 2018
  8. 2/6 tree-walk: Add three new gentle helpersPaul-Sebastian Ungureanu, Jul 17, 2018
  9. Junio C HamanoJul 17, 2018
  10. Paul-Sebastian UngureanuJul 18, 2018
  11. 1/6 sha1-name: Add `GET_OID_GENTLY` flagPaul-Sebastian Ungureanu, Jul 17, 2018
  12. Duy NguyenJul 17, 2018
  13. Paul-Sebastian UngureanuJul 18, 2018

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.