From 66df204c440de3b0cf3442d3a0c719016cdcf9c6 Mon Sep 17 00:00:00 2001 From: Oscar Benedito Date: Mon, 16 Nov 2020 23:24:32 +0100 Subject: [PATCH] add abbreviated commit hash to submodule file --- stagit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stagit.c b/stagit.c index 12a76a4..1cdaee8 100644 --- 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, "m---------", relpath); xmlencode(fp, entrypath, strlen(entrypath)); - fputs("\n", fp); + fputs(" @ ", fp); + git_oid_tostr(oid, sizeof(oid), git_tree_entry_id(entry)); + xmlencode(fp, oid, strlen(oid)); + fputs("\n", fp); } } -- libgit2 1.1.1