git-query
git data extraction tool using c and libgit2
git clone https://9o.is/git/git-query.git
commit e980991e1511c3bf6d63463acfe467e6bfe129f4 parent be00da95e6de1d7c522477d4daa0291dbb395996 Author: Oscar Benedito <oscar@oscarbenedito.com> Date: Mon, 16 Nov 2020 23:24:32 +0100 add abbreviated commit hash to submodule file Diffstat:
| M | stagit.c | | | 7 | +++++-- |
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/stagit.c b/stagit.c @@ -977,7 +977,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) git_object *obj = NULL; git_off_t filesize; const char *entryname; - char filepath[PATH_MAX], entrypath[PATH_MAX]; + char filepath[PATH_MAX], entrypath[PATH_MAX], oid[8]; size_t count, i, lc; int r, ret; @@ -1031,7 +1031,10 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) fprintf(fp, "<tr><td>m---------</td><td><a href=\"%sfile/.gitmodules.html\">", relpath); xmlencode(fp, entrypath, strlen(entrypath)); - fputs("</a></td><td class=\"num\" align=\"right\"></td></tr>\n", fp); + fputs("</a> @ ", fp); + git_oid_tostr(oid, sizeof(oid), git_tree_entry_id(entry)); + xmlencode(fp, oid, strlen(oid)); + fputs("</td><td class=\"num\" align=\"right\"></td></tr>\n", fp); } }