add abbreviated commit hash to submodule file - stagit-gopher - A git gopher frontend. (mirror) HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit f1c1f8c810b311b9f786847dda2494c397cc1ddf DIR parent 17ce8c9ec7b5fc669fe3c1285c29b5b6fd1a409a HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Tue, 24 Nov 2020 01:23:12 +0100 add abbreviated commit hash to submodule file sync the similar change as stagit. Small change: do not align names of submodules anymore because of the abbreviated commit after the name. Just assume the submodule name is short. Patch for stagit was from: Oscar Benedito <oscar@oscarbenedito.com> Diffstat: M stagit-gopher.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- DIR diff --git a/stagit-gopher.c b/stagit-gopher.c @@ -1051,7 +1051,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) git_object *obj = NULL; git_off_t filesize; const char *entryname; - char buf[256], filepath[PATH_MAX], entrypath[PATH_MAX]; + char buf[256], filepath[PATH_MAX], entrypath[PATH_MAX], oid[8]; size_t count, i, lc; int r, ret; @@ -1104,8 +1104,10 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) } else if (git_tree_entry_type(entry) == GIT_OBJ_COMMIT) { /* commit object in tree is a submodule */ fputs("[1|m--------- ", fp); - utf8pad(buf, sizeof(buf), entrypath, 50, ' '); - gphlink(fp, buf, strlen(buf)); + gphlink(fp, entrypath, strlen(entrypath)); + fputs(" @ ", fp); + git_oid_tostr(oid, sizeof(oid), git_tree_entry_id(entry)); + gphlink(fp, oid, strlen(oid)); fprintf(fp, "|%s/file/.gitmodules.gph|server|port]\n", relpath); /* NOTE: linecount omitted */ }