diff --git a/stagit.c b/stagit.c index 7b16f32..206dca1 100644 --- 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("\n", fp); } else if (git_submodule_lookup(&module, repo, entryname) == 0) { - moduleurl = git_submodule_url(module); - fprintf(fp, "m---------", - moduleurl); + fputs("m---------", fp); + if ((moduleurl = git_submodule_url(module))) { + fprintf(fp, "", + moduleurl); + } xmlencode(fp, entrypath, strlen(entrypath)); - fputs(" @", fp); - xmlencode(fp, moduleurl, strlen(moduleurl)); - fprintf(fp, "0%c", + if (moduleurl) { + fputs(" @", fp); + xmlencode(fp, moduleurl, strlen(moduleurl)); + fputs("", fp); + } + fprintf(fp, "0%c", showlinecount ? 'L' : 'B'); git_submodule_free(module); fputs("\n", fp);