stagit

static git page generator  https://git.ce9e.org
git clone https://git.ce9e.org/stagit.git

commit
b24cdfc14a898af0cca18bfb1be1fe825ae480aa
parent
4604b321b3099eae22c6c1823cd5c9c492c402a5
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-03-28 08:59
rename functions

Diffstat

M stagit.c 58 +++++++++++++++++++++++++++++-----------------------------

1 files changed, 29 insertions, 29 deletions


diff --git a/stagit.c b/stagit.c

@@ -318,7 +318,7 @@ printtimeshort(FILE *fp, const git_time *intime)
  318   318 }
  319   319 
  320   320 void
  321    -1 writeheader(FILE *fp, const char *title)
   -1   321 write_header(FILE *fp, const char *title)
  322   322 {
  323   323 	fputs("<!DOCTYPE html>\n"
  324   324 		"<html>\n<head>\n"
@@ -357,13 +357,13 @@ writeheader(FILE *fp, const char *title)
  357   357 }
  358   358 
  359   359 void
  360    -1 writefooter(FILE *fp)
   -1   360 write_footer(FILE *fp)
  361   361 {
  362   362 	fputs("</div>\n</body>\n</html>\n", fp);
  363   363 }
  364   364 
  365   365 void
  366    -1 writereadmehtml(FILE *fp, const git_blob *blob)
   -1   366 write_readme(FILE *fp, const git_blob *blob)
  367   367 {
  368   368 	const void *raw = git_blob_rawcontent(blob);
  369   369 	git_off_t len = git_blob_rawsize(blob);
@@ -382,7 +382,7 @@ writereadmehtml(FILE *fp, const git_blob *blob)
  382   382 }
  383   383 
  384   384 void
  385    -1 printcommit(FILE *fp, struct commitinfo *ci)
   -1   385 write_commit(FILE *fp, struct commitinfo *ci)
  386   386 {
  387   387 	fprintf(fp, "<b>commit</b> <a href=\"%scommit/%s.html\">%s</a>\n",
  388   388 		relpath, ci->oid, ci->oid);
@@ -410,7 +410,7 @@ printcommit(FILE *fp, struct commitinfo *ci)
  410   410 }
  411   411 
  412   412 void
  413    -1 printshowfile(FILE *fp, struct commitinfo *ci)
   -1   413 write_commit_file(FILE *fp, struct commitinfo *ci)
  414   414 {
  415   415 	const git_diff_delta *delta;
  416   416 	const git_diff_hunk *hunk;
@@ -420,7 +420,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
  420   420 	char linestr[80];
  421   421 	int c;
  422   422 
  423    -1 	printcommit(fp, ci);
   -1   423 	write_commit(fp, ci);
  424   424 
  425   425 	if (!ci->deltas)
  426   426 		return;
@@ -534,7 +534,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
  534   534 }
  535   535 
  536   536 void
  537    -1 writelogline(FILE *fp, struct commitinfo *ci)
   -1   537 write_log_line(FILE *fp, struct commitinfo *ci)
  538   538 {
  539   539 	fputs("<tr><td>", fp);
  540   540 	if (ci->author)
@@ -558,7 +558,7 @@ writelogline(FILE *fp, struct commitinfo *ci)
  558   558 }
  559   559 
  560   560 int
  561    -1 writelog(FILE *fp, const git_oid *oid)
   -1   561 write_log(FILE *fp, const git_oid *oid)
  562   562 {
  563   563 	struct commitinfo *ci;
  564   564 	git_revwalk *w = NULL;
@@ -595,9 +595,9 @@ writelog(FILE *fp, const git_oid *oid)
  595   595 			goto err;
  596   596 
  597   597 		if (nlogcommits < 0) {
  598    -1 			writelogline(fp, ci);
   -1   598 			write_log_line(fp, ci);
  599   599 		} else if (nlogcommits > 0) {
  600    -1 			writelogline(fp, ci);
   -1   600 			write_log_line(fp, ci);
  601   601 			nlogcommits--;
  602   602 			if (!nlogcommits && ci->parentoid[0])
  603   603 				fputs("<tr><td></td><td colspan=\"5\">"
@@ -606,17 +606,17 @@ writelog(FILE *fp, const git_oid *oid)
  606   606 		}
  607   607 
  608   608 		if (cachefile)
  609    -1 			writelogline(wcachefp, ci);
   -1   609 			write_log_line(wcachefp, ci);
  610   610 
  611   611 		/* check if file exists if so skip it */
  612   612 		if (r) {
  613   613 			relpath = "../";
  614   614 			fpfile = efopen(path, "w");
  615    -1 			writeheader(fpfile, ci->summary);
   -1   615 			write_header(fpfile, ci->summary);
  616   616 			fputs("<pre>", fpfile);
  617    -1 			printshowfile(fpfile, ci);
   -1   617 			write_commit_file(fpfile, ci);
  618   618 			fputs("</pre>\n", fpfile);
  619    -1 			writefooter(fpfile);
   -1   619 			write_footer(fpfile);
  620   620 			fclose(fpfile);
  621   621 		}
  622   622 err:
@@ -630,7 +630,7 @@ err:
  630   630 }
  631   631 
  632   632 void
  633    -1 printcommitatom(FILE *fp, struct commitinfo *ci)
   -1   633 write_atom_entry(FILE *fp, struct commitinfo *ci)
  634   634 {
  635   635 	fputs("<entry>\n", fp);
  636   636 
@@ -670,7 +670,7 @@ printcommitatom(FILE *fp, struct commitinfo *ci)
  670   670 }
  671   671 
  672   672 int
  673    -1 writeatom(FILE *fp)
   -1   673 write_atom(FILE *fp)
  674   674 {
  675   675 	struct commitinfo *ci;
  676   676 	git_revwalk *w = NULL;
@@ -691,7 +691,7 @@ writeatom(FILE *fp)
  691   691 	for (i = 0; i < m && !git_revwalk_next(&id, w); i++) {
  692   692 		if (!(ci = commitinfo_getbyoid(&id)))
  693   693 			break;
  694    -1 		printcommitatom(fp, ci);
   -1   694 		write_atom_entry(fp, ci);
  695   695 		commitinfo_free(ci);
  696   696 	}
  697   697 	git_revwalk_free(w);
@@ -702,7 +702,7 @@ writeatom(FILE *fp)
  702   702 }
  703   703 
  704   704 int
  705    -1 writeblob(git_object *obj, const char *fpath, const char *filename, git_off_t filesize)
   -1   705 copy_blob(git_object *obj, const char *fpath, const char *filename, git_off_t filesize)
  706   706 {
  707   707 	char tmp[PATH_MAX] = "", *d;
  708   708 	int lc = 0;
@@ -767,7 +767,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
  767   767 			}
  768   768 
  769   769 			filesize = git_blob_rawsize((git_blob *)obj);
  770    -1 			lc = writeblob(obj, filepath, entryname, filesize);
   -1   770 			lc = copy_blob(obj, filepath, entryname, filesize);
  771   771 
  772   772 			fprintf(fp, "<tr><td><a href=\"%s", relpath);
  773   773 			xmlencode(fp, filepath, strlen(filepath));
@@ -787,7 +787,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
  787   787 }
  788   788 
  789   789 int
  790    -1 writefiles(FILE *fp, const git_oid *id)
   -1   790 write_files(FILE *fp, const git_oid *id)
  791   791 {
  792   792 	git_tree *tree = NULL;
  793   793 	git_commit *commit = NULL;
@@ -926,7 +926,7 @@ main(int argc, char *argv[])
  926   926 	fp = efopen("log.html", "w");
  927   927 	relpath = "";
  928   928 	mkdir("commit", S_IRWXU | S_IRWXG | S_IRWXO);
  929    -1 	writeheader(fp, "Log");
   -1   929 	write_header(fp, "Log");
  930   930 	fputs("<table id=\"log\"><thead>\n<tr><td><b>Date</b></td>"
  931   931 	      "<td><b>Commit message</b></td>"
  932   932 	      "<td><b>Author</b></td><td class=\"num\" align=\"right\"><b>Files</b></td>"
@@ -951,7 +951,7 @@ main(int argc, char *argv[])
  951   951 		git_oid_tostr(buf, sizeof(buf), head);
  952   952 		fprintf(wcachefp, "%s\n", buf);
  953   953 
  954    -1 		writelog(fp, head);
   -1   954 		write_log(fp, head);
  955   955 
  956   956 		if (rcachefp) {
  957   957 			/* append previous log to log.html and the new cache */
@@ -968,32 +968,32 @@ main(int argc, char *argv[])
  968   968 		fclose(wcachefp);
  969   969 	} else {
  970   970 		if (head)
  971    -1 			writelog(fp, head);
   -1   971 			write_log(fp, head);
  972   972 	}
  973   973 
  974   974 	fputs("</tbody></table>", fp);
  975    -1 	writefooter(fp);
   -1   975 	write_footer(fp);
  976   976 	fclose(fp);
  977   977 
  978   978 	/* files for HEAD */
  979   979 	fp = efopen("files.html", "w");
  980    -1 	writeheader(fp, "Files");
   -1   980 	write_header(fp, "Files");
  981   981 	if (head)
  982    -1 		writefiles(fp, head);
   -1   982 		write_files(fp, head);
  983   983 	for (i = 0; i < sizeof(readmefiles) / sizeof(*readmefiles) && !readme; i++) {
  984   984 		if (!git_revparse_single(&obj, repo, readmefiles[i]) &&
  985   985 		    git_object_type(obj) == GIT_OBJ_BLOB) {
  986   986 			readme = readmefiles[i];
  987    -1 			writereadmehtml(fp, (git_blob *)obj);
   -1   987 			write_readme(fp, (git_blob *)obj);
  988   988 		}
  989   989 		git_object_free(obj);
  990   990 	}
  991    -1 	writefooter(fp);
   -1   991 	write_footer(fp);
  992   992 	fclose(fp);
  993   993 
  994   994 	/* Atom feed */
  995   995 	fp = efopen("atom.xml", "w");
  996    -1 	writeatom(fp);
   -1   996 	write_atom(fp);
  997   997 	fclose(fp);
  998   998 
  999   999 	/* rename new cache file on success */