- commit
- 21f30b3ace4f14a5d91d752377a2858474f6ce10
- parent
- 012fde8a61202aec1aba8be629e083fc1a8a3cd2
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-03-26 15:55
combine readme and files in first tab
Diffstat
M | stagit.c | 32 | ++++++++++++++++++++------------ |
1 files changed, 20 insertions, 12 deletions
diff --git a/stagit.c b/stagit.c
@@ -370,15 +370,12 @@ writeheader(FILE *fp, const char *title) 370 370 fputs("</a></td></tr>", fp); 371 371 } 372 372 fputs("<tr><td></td><td>\n", fp);373 -1 fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);374 373 fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath); -1 374 fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath); 375 375 fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath); 376 376 if (submodules) 377 377 fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>", 378 378 relpath, submodules);379 -1 if (readme)380 -1 fprintf(fp, " | <a href=\"%sfile/%s.html\">README</a>",381 -1 relpath, readme);382 379 if (license) 383 380 fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>", 384 381 relpath, license); @@ -424,6 +421,17 @@ writeblobhtml(FILE *fp, const git_blob *blob) 424 421 } 425 422 426 423 void -1 424 writereadmehtml(FILE *fp, const git_blob *blob) -1 425 { -1 426 const void *raw = git_blob_rawcontent(blob); -1 427 git_off_t len = git_blob_rawsize(blob); -1 428 -1 429 fputs("<pre id=\"readme\">\n", fp); -1 430 fwrite(raw, 1, len, fp); -1 431 fputs("</pre>\n", fp); -1 432 } -1 433 -1 434 void 427 435 printcommit(FILE *fp, struct commitinfo *ci) 428 436 { 429 437 fprintf(fp, "<b>commit</b> <a href=\"%scommit/%s.html\">%s</a>\n", @@ -1167,14 +1175,6 @@ main(int argc, char *argv[]) 1167 1175 git_object_free(obj); 1168 1176 } 1169 11771170 -1 /* check README */1171 -1 for (i = 0; i < sizeof(readmefiles) / sizeof(*readmefiles) && !readme; i++) {1172 -1 if (!git_revparse_single(&obj, repo, readmefiles[i]) &&1173 -1 git_object_type(obj) == GIT_OBJ_BLOB)1174 -1 readme = readmefiles[i] + strlen("HEAD:");1175 -1 git_object_free(obj);1176 -1 }1177 -11178 1178 if (!git_revparse_single(&obj, repo, "HEAD:.gitmodules") && 1179 1179 git_object_type(obj) == GIT_OBJ_BLOB) 1180 1180 submodules = ".gitmodules"; @@ -1238,6 +1238,14 @@ main(int argc, char *argv[]) 1238 1238 writeheader(fp, "Files"); 1239 1239 if (head) 1240 1240 writefiles(fp, head); -1 1241 for (i = 0; i < sizeof(readmefiles) / sizeof(*readmefiles) && !readme; i++) { -1 1242 if (!git_revparse_single(&obj, repo, readmefiles[i]) && -1 1243 git_object_type(obj) == GIT_OBJ_BLOB) { -1 1244 readme = readmefiles[i]; -1 1245 writereadmehtml(fp, (git_blob *)obj); -1 1246 } -1 1247 git_object_free(obj); -1 1248 } 1241 1249 writefooter(fp); 1242 1250 fclose(fp); 1243 1251