add abbreviated commit hash to submodule file
authorOscar Benedito <oscar@oscarbenedito.com>
Mon, 16 Nov 2020 22:24:32 +0000 (23:24 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Mon, 23 Nov 2020 16:15:30 +0000 (17:15 +0100)
stagit.c

index 12a76a4b0aa29a168a65a37d4728d87db8290305..1cdaee8dfa2bdb5a1403d5628d03c50a2821c4a7 100644 (file)
--- 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);
                }
        }