git-query

git data extraction tool using c and libgit2

git clone https://9o.is/git/git-query.git

commit be9f6effb53a1418fd4d12471bc8311921dd0dbf
parent 4ce86e0a6b106c740b0e4d0873805f86399fe50d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 29 Apr 2016 12:32:36 +0200

tweak style of showing submodules

this will make it look similar to cgit. show mode as "m---------"

Diffstat:
Mstagit.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/stagit.c b/stagit.c @@ -654,7 +654,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *branch, const char *path) { const git_tree_entry *entry = NULL; git_submodule *module = NULL; - const char *entryname; + const char *entryname, *moduleurl; char filepath[PATH_MAX], entrypath[PATH_MAX]; git_object *obj = NULL; git_off_t filesize; @@ -709,10 +709,12 @@ writefilestree(FILE *fp, git_tree *tree, const char *branch, const char *path) fprintf(fp, "%juB", (uintmax_t)filesize); fputs("</td></tr>\n", fp); } else if (git_submodule_lookup(&module, repo, entryname) == 0) { - - fprintf(fp, "<tr><td></td><td><a class=\"module\" href=\"%s\">@", - git_submodule_url(module)); + moduleurl = git_submodule_url(module); + fprintf(fp, "<tr><td>m---------</td><td><a class=\"module\" href=\"%s\">", + moduleurl); xmlencode(fp, entrypath, strlen(entrypath)); + fputs(" @", fp); + xmlencode(fp, moduleurl, strlen(moduleurl)); fprintf(fp, "</a></td><td class=\"num\">0%c", showlinecount ? 'L' : 'B'); git_submodule_free(module);