Skip to content

RFC Add gentle alternative for `get_oid()`

Paul-Sebastian Ungureanu git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6sha1-name: Add `GET_OID_GENTLY` flagcache.h+1 -00 replies
2/6tree-walk: Add three new gentle helperssha1-name.c tree-walk.c tree-walk.h+94 -192 replies
3/6refs.c: Teach `read_ref_at()` to accept `GET_OID_GENTLY` flagrefs.c+2 -00 replies
4/6sha1-name: Teach `get_oid_basic()` to be gentlesha1-name.c+12 -40 replies
5/6sha1-name: Teach `get_oid_with_context[_1]()` to be gentlesha1-name.c+83 -202 replies
6/6sha1-name: Add gentle alternative for `get_oid()`cache.h sha1-name.c+7 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/6] Add gentle alternative for `get_oid()`

At the moment, get_oid() might call die() in some cases. To prevent that from happening, this patches introduces a new flag called GET_OID_GENTLY and a new function get_oid_gently(), which passes the mentioned flag further to get_oid_with_context().

The call graph of get_oid() is pretty complex and I hope I covered all the cases where exit() might be called. Although I believe this series of patches will not introduce any regression and work as intended, I think that is better to mark it with [RFC].

This patch would be useful for converting git stash to C. At the moment, git stash spawns a child process to avoid get_oid() to die. If this series turns out to be good enough to be accepted, do I need to wait until it gets merged in master to use it in the other project mentioned before?

Thanks,
Paul

Paul-Sebastian Ungureanu (6):
sha1-name: Add GET_OID_GENTLY flag
tree-walk: Add three new gentle helpers
refs.c: Teach read_ref_at() to accept GET_OID_GENTLY flag
sha1-name: Teach get_oid_basic() to be gentle
sha1-name: Teach get_oid_with_context[_1]() to be gentle
sha1-name: Add gentle alternative for get_oid()

 cache.h     |   2 +
 refs.c      |   2 +
 sha1-name.c | 127 +++++++++++++++++++++++++++++++++++++++++-----------
 tree-walk.c | 108 +++++++++++++++++++++++++++++++++++++-------
 tree-walk.h |   3 +-
 5 files changed, 199 insertions(+), 43 deletions(-)
Signature · 1 line
2.18.0.rc2.184.ga79db55c2.dirty