stagit

Fork of hiltjo's stagit (see http://codemadness.org/stagit.html)
git clone git://git.vgx.fr/stagit
Log | Files | Refs | README | LICENSE

commit b8af751b0108edcad02bc59cec496b1d7808b0e1
parent 375d41dcce94106460f1b3855ebb295ccb138593
Author: Quentin Rameau <quinq@fifth.space>
Date:   Fri, 29 Apr 2016 14:01:45 +0200

Fix null pointer access for submodules in writefilestree

Do not try to set a link to submodules from bare repo as we can't get
the actual url.

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

diff --git a/stagit.c b/stagit.c @@ -709,13 +709,18 @@ 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) { - moduleurl = git_submodule_url(module); - fprintf(fp, "<tr><td>m---------</td><td><a class=\"module\" href=\"%s\">", - moduleurl); + fputs("<tr><td>m---------</td><td>", fp); + if ((moduleurl = git_submodule_url(module))) { + fprintf(fp, "<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", + if (moduleurl) { + fputs(" @", fp); + xmlencode(fp, moduleurl, strlen(moduleurl)); + fputs("</a>", fp); + } + fprintf(fp, "</td><td class=\"num\">0%c", showlinecount ? 'L' : 'B'); git_submodule_free(module); fputs("</td></tr>\n", fp);