summaryrefslogtreecommitdiff
path: root/urmoms.c
diff options
context:
space:
mode:
authorEivind Uggedal <eivind@uggedal.com>2015-12-11 10:03:19 +0000
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-12-11 12:36:17 +0100
commitf33bca44bdd4f6758b9045c02ddbab9adc7b97c0 (patch)
treecbaefb8c86739de4fae06b9e6cd0d586dbc1f0c4 /urmoms.c
parent57d70b0a2d945470402b9a9a61ce72289025a36c (diff)
Dynamic relpath for blob pages
Diffstat (limited to 'urmoms.c')
-rw-r--r--urmoms.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/urmoms.c b/urmoms.c
index de49636..b1c2aff 100644
--- a/urmoms.c
+++ b/urmoms.c
@@ -555,6 +555,8 @@ writeblob(const git_index_entry *entry)
{
char fpath[PATH_MAX];
char ref[PATH_MAX];
+ char tmp[PATH_MAX] = "";
+ char *p;
git_object *obj = NULL;
FILE *fp;
@@ -567,7 +569,13 @@ writeblob(const git_index_entry *entry)
if (mkdirp(dirname(fpath)))
return 1;
- relpath = "../"; /* TODO: dynamic relpath based on number of /'s */
+ p = fpath;
+ while (*p) {
+ if (*p == '/')
+ strlcat(tmp, "../", sizeof(tmp));
+ p++;
+ }
+ relpath = tmp;
fp = efopen(fpath, "w+b");
writeheader(fp);