commit ab46ca27fc26888dc6e061c614d085114eb7b1ea
parent b1f0c95f2975540809eb6ff3bcd04023b71a87de
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 9 Feb 2018 16:09:10 +0100
when a tags.gph file exists in the current directory then link it in the menu
Diffstat:
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/stagit-gopher.1 b/stagit-gopher.1
@@ -93,6 +93,9 @@ primary clone url of the repository, for example: git://git.2f30.org/stagit
.Pp
When a README or LICENSE file exists in HEAD or a .gitmodules submodules file
exists in HEAD a direct link in the index is made.
+.Pp
+When a tags.gph file exists in the current directory it is linked in the
+index as a "Tags" link.
.Sh SEE ALSO
.Xr stagit-gopher-index 1
.Sh AUTHORS
diff --git a/stagit-gopher.c b/stagit-gopher.c
@@ -58,7 +58,7 @@ static char *name = "";
static char *strippedname = "";
static char description[255];
static char cloneurl[1024];
-static int haslicense, hasreadme, hassubmodules;
+static int haslicense, hasreadme, hassubmodules, hastagsgph;
static long long nlogcommits = -1; /* < 0 indicates not used */
/* cache */
@@ -447,6 +447,8 @@ writeheader(FILE *fp, const char *title)
fprintf(fp, "[1|Log|%s/log.gph|server|port]\n", relpath);
fprintf(fp, "[1|Files|%s/files.gph|server|port]\n", relpath);
fprintf(fp, "[1|Refs|%s/refs.gph|server|port]\n", relpath);
+ if (hastagsgph)
+ fprintf(fp, "[1|Tags|%s/tags.gph|server|port]\n", relpath);
if (hassubmodules)
fprintf(fp, "[1|Submodules|%s/file/.gitmodules.gph|server|port]\n", relpath);
if (hasreadme)
@@ -1191,6 +1193,9 @@ main(int argc, char *argv[])
fclose(fpread);
}
+ /* check if tags.gph file exists */
+ hastagsgph = (access("tags.gph", F_OK) == 0);
+
/* check LICENSE */
haslicense = (!git_revparse_single(&obj, repo, "HEAD:LICENSE") &&
git_object_type(obj) == GIT_OBJ_BLOB);