commit f33c53572d55083e67743144e2e3fbd976ed3d8f
parent a396a52cee34ccad0eba418738915d1b3281fc74
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 23 May 2022 18:36:20 +0200
parent a396a52cee34ccad0eba418738915d1b3281fc74
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 23 May 2022 18:36:20 +0200
commitinfo_getbyid: add short_oid
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/stagit.c b/stagit.c @@ -37,6 +37,7 @@ struct commitinfo { const char *summary; const char *msg; + git_buf short_oid; git_diff *diff; git_commit *commit; git_commit *parent; @@ -226,6 +227,7 @@ commitinfo_free(struct commitinfo *ci) deltainfo_free(ci->deltas[i]); free(ci->deltas); + git_buf_free(&ci->short_oid); git_diff_free(ci->diff); git_tree_free(ci->commit_tree); git_tree_free(ci->parent_tree); @@ -247,6 +249,8 @@ commitinfo_getbyoid(const git_oid *id) goto err; ci->id = id; + git_object_short_id(&ci->short_oid, (git_object*)ci->commit); + git_oid_tostr(ci->oid, sizeof(ci->oid), git_commit_id(ci->commit)); git_oid_tostr(ci->parentoid, sizeof(ci->parentoid), git_commit_parent_id(ci->commit, 0));