stagit

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

commit
c40e435cebc4d94258cccd1a26328c1069fc5855
parent
142ed81f2852cd42d57eb3ac785b3fdb31c367ce
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-03-28 07:59
rm filemode

Diffstat

M stagit.c 48 ++----------------------------------------------

1 files changed, 2 insertions, 46 deletions


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

@@ -757,48 +757,6 @@ writeblob(git_object *obj, const char *fpath, const char *filename, git_off_t fi
  757   757 	return lc;
  758   758 }
  759   759 
  760    -1 const char *
  761    -1 filemode(git_filemode_t m)
  762    -1 {
  763    -1 	static char mode[11];
  764    -1 
  765    -1 	memset(mode, '-', sizeof(mode) - 1);
  766    -1 	mode[10] = '\0';
  767    -1 
  768    -1 	if (S_ISREG(m))
  769    -1 		mode[0] = '-';
  770    -1 	else if (S_ISBLK(m))
  771    -1 		mode[0] = 'b';
  772    -1 	else if (S_ISCHR(m))
  773    -1 		mode[0] = 'c';
  774    -1 	else if (S_ISDIR(m))
  775    -1 		mode[0] = 'd';
  776    -1 	else if (S_ISFIFO(m))
  777    -1 		mode[0] = 'p';
  778    -1 	else if (S_ISLNK(m))
  779    -1 		mode[0] = 'l';
  780    -1 	else if (S_ISSOCK(m))
  781    -1 		mode[0] = 's';
  782    -1 	else
  783    -1 		mode[0] = '?';
  784    -1 
  785    -1 	if (m & S_IRUSR) mode[1] = 'r';
  786    -1 	if (m & S_IWUSR) mode[2] = 'w';
  787    -1 	if (m & S_IXUSR) mode[3] = 'x';
  788    -1 	if (m & S_IRGRP) mode[4] = 'r';
  789    -1 	if (m & S_IWGRP) mode[5] = 'w';
  790    -1 	if (m & S_IXGRP) mode[6] = 'x';
  791    -1 	if (m & S_IROTH) mode[7] = 'r';
  792    -1 	if (m & S_IWOTH) mode[8] = 'w';
  793    -1 	if (m & S_IXOTH) mode[9] = 'x';
  794    -1 
  795    -1 	if (m & S_ISUID) mode[3] = (mode[3] == 'x') ? 's' : 'S';
  796    -1 	if (m & S_ISGID) mode[6] = (mode[6] == 'x') ? 's' : 'S';
  797    -1 	if (m & S_ISVTX) mode[9] = (mode[9] == 'x') ? 't' : 'T';
  798    -1 
  799    -1 	return mode;
  800    -1 }
  801    -1 
  802   760 int
  803   761 writefilestree(FILE *fp, git_tree *tree, const char *path)
  804   762 {
@@ -842,9 +800,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
  842   800 			filesize = git_blob_rawsize((git_blob *)obj);
  843   801 			lc = writeblob(obj, filepath, entryname, filesize);
  844   802 
  845    -1 			fputs("<tr><td>", fp);
  846    -1 			fputs(filemode(git_tree_entry_filemode(entry)), fp);
  847    -1 			fprintf(fp, "</td><td><a href=\"%s", relpath);
   -1   803 			fprintf(fp, "<tr><td><a href=\"%s", relpath);
  848   804 			xmlencode(fp, filepath, strlen(filepath));
  849   805 			fputs("\">", fp);
  850   806 			xmlencode(fp, entrypath, strlen(entrypath));
@@ -869,7 +825,7 @@ writefiles(FILE *fp, const git_oid *id)
  869   825 	int ret = -1;
  870   826 
  871   827 	fputs("<table id=\"files\"><thead>\n<tr>"
  872    -1 	      "<td><b>Mode</b></td><td><b>Name</b></td>"
   -1   828 	      "<td><b>Name</b></td>"
  873   829 	      "<td class=\"num\" align=\"right\"><b>Size</b></td>"
  874   830 	      "</tr>\n</thead><tbody>\n", fp);
  875   831