Introduction
Introduction Statistics Contact Development Disclaimer Help
tstagit.c: allow specifying alternate clone url in alturl file - stagit - [fork…
git clone git://src.adamsgaard.dk/stagit
Log
Files
Refs
README
LICENSE
---
commit 7e58463ae5df8c8ff71767d71257388c9f8a11c3
parent 02b67e7268ee2cb11a0fe254a832f7e6f0dcf85d
Author: Anders Damsgaard <[email protected]>
Date: Sat, 28 Nov 2020 00:29:38 +0100
stagit.c: allow specifying alternate clone url in alturl file
Diffstat:
M stagit.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/stagit.c b/stagit.c
t@@ -66,6 +66,7 @@ static char *name = "";
static char *strippedname = "";
static char description[255];
static char cloneurl[1024];
+static char altcloneurl[1024];
static char *submodules;
static char *releasedir = "../releases";
static char *licensefiles[] = { "HEAD:LICENSE", "HEAD:LICENSE.md", "HEAD:LICEN…
t@@ -479,7 +480,15 @@ writeheader(FILE *fp, const char *title)
xmlencode(fp, cloneurl, strlen(cloneurl));
fputs("\">", fp);
xmlencode(fp, cloneurl, strlen(cloneurl));
- fputs("</a></td></tr>", fp);
+ fputs("</a>", fp);
+ if (altcloneurl[0]) {
+ fputs("<br />\ngit clone <a href=\"", fp);
+ xmlencode(fp, altcloneurl, strlen(altcloneurl));
+ fputs("\">", fp);
+ xmlencode(fp, altcloneurl, strlen(altcloneurl));
+ fputs("</a>", fp);
+ }
+ fputs("</td></tr>", fp);
}
fputs("<tr><td></td><td>\n", fp);
fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
t@@ -1242,6 +1251,19 @@ main(int argc, char *argv[])
fclose(fpread);
}
+ /* read alturl or .git/alturl */
+ joinpath(path, sizeof(path), repodir, "alturl");
+ if (!(fpread = fopen(path, "r"))) {
+ joinpath(path, sizeof(path), repodir, ".git/alturl");
+ fpread = fopen(path, "r");
+ }
+ if (fpread) {
+ if (!fgets(altcloneurl, sizeof(altcloneurl), fpread))
+ altcloneurl[0] = '\0';
+ altcloneurl[strcspn(altcloneurl, "\n")] = '\0';
+ fclose(fpread);
+ }
+
/* check LICENSE */
for (i = 0; i < LEN(licensefiles) && !license; i++) {
if (!git_revparse_single(&obj, repo, licensefiles[i]) &&
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.