- commit
- f4941a7511106dfee7bcecbcb7a7ab5c4c799b7f
- parent
- 0b28d0832592ca51a81730779b917f63b42a1642
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-03-30 06:33
mv some constants to config.h
Diffstat
M | Makefile | 2 | +- |
A | config.h | 6 | ++++++ |
M | stagit.c | 18 | ++++++++++-------- |
3 files changed, 17 insertions, 9 deletions
diff --git a/Makefile b/Makefile
@@ -30,7 +30,7 @@ MAN1 = \ 30 30 DOC = \ 31 31 LICENSE\ 32 32 README33 -1 HDR = compat.h-1 33 HDR = compat.h config.h 34 34 35 35 COMPATOBJ = \ 36 36 strlcpy.o
diff --git a/config.h b/config.h
@@ -0,0 +1,6 @@ -1 1 static const char *logo = ""; -1 2 static const char *favicon = ""; -1 3 static const char *stylesheet = "/style.css"; -1 4 static const char *cloneurl = "git://git.example.com/"; -1 5 static char *readmefiles[] = { "HEAD:README", "HEAD:README.md", "HEAD:README.rst" }; -1 6 static int force_commits = 0;
diff --git a/stagit.c b/stagit.c
@@ -19,6 +19,7 @@ 19 19 #endif 20 20 21 21 #include "compat.h" -1 22 #include "config.h" 22 23 23 24 struct deltainfo { 24 25 git_patch *patch; @@ -55,9 +56,6 @@ static const char *repodir; 55 56 char repodirabs[PATH_MAX + 1]; 56 57 static char *reponame = ""; 57 58 static char description[255];58 -1 static char *cloneurl = "git@git.example.com:";59 -1 static char *readmefiles[] = { "HEAD:README", "HEAD:README.md", "HEAD:README.rst" };60 -1 static int force = 1;61 59 62 60 void 63 61 joinpath(char *buf, size_t bufsiz, const char *path, const char *path2) @@ -327,13 +325,17 @@ write_header(FILE *fp, const char *title) 327 325 if (description[0]) 328 326 fputs(" - ", fp); 329 327 xmlencode(fp, description, strlen(description));330 -1 fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath);-1 328 fputs(fp, "</title>\n"); -1 329 if (favicon[0]) -1 330 fprintf(fp, "<link rel=\"icon\" type=\"image/png\" href=\"%s\" />\n", favicon); 331 331 fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n", 332 332 reponame, relpath);333 -1 fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath);-1 333 if (stylesheet[0]) -1 334 fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n", stylesheet); 334 335 fputs("</head>\n<body>\n<table><tr><td>", fp);335 -1 fprintf(fp, "<a href=\"../%s\"><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",336 -1 relpath, relpath);-1 336 if (logo[0]) -1 337 fprintf(fp, "<a href=\"../%s\"><img src=\"%s\" alt=\"\" width=\"32\" height=\"32\" /></a>", -1 338 relpath, logo); 337 339 fputs("</td><td><h1>", fp); 338 340 xmlencode(fp, reponame, strlen(reponame)); 339 341 fputs("</h1><span class=\"desc\">", fp); @@ -803,7 +805,7 @@ process_commits(FILE *fp_log, FILE *fp_atom, size_t m) 803 805 git_oid_tostr(oidstr, sizeof(oidstr), &id); 804 806 snprintf(path, sizeof(path), "commit/%s.html", oidstr); 805 807806 -1 if (force || access(path, F_OK)) {-1 808 if (force_commits || access(path, F_OK)) { 807 809 relpath = "../"; 808 810 mkdirp("commit"); 809 811 fp_commit = efopen(path, "w");