Dynamic relpath for blob pages
1 files changed, 9 insertions(+), 1 deletions(-) | |||
---|---|---|---|
M | urmoms.c | +9 | -1 |
1@@ -555,6 +555,8 @@ writeblob(const git_index_entry *entry)
2 {
3 char fpath[PATH_MAX];
4 char ref[PATH_MAX];
5+ char tmp[PATH_MAX] = "";
6+ char *p;
7 git_object *obj = NULL;
8 FILE *fp;
9
10@@ -567,7 +569,13 @@ writeblob(const git_index_entry *entry)
11 if (mkdirp(dirname(fpath)))
12 return 1;
13
14- relpath = "../"; /* TODO: dynamic relpath based on number of /'s */
15+ p = fpath;
16+ while (*p) {
17+ if (*p == '/')
18+ strlcat(tmp, "../", sizeof(tmp));
19+ p++;
20+ }
21+ relpath = tmp;
22
23 fp = efopen(fpath, "w+b");
24 writeheader(fp);