K Jayatheerth [off-list ref] writes:
+static int get_path_cdup(struct repository *repo, struct strbuf *buf)
+{
+ const char *pfx = repo->prefix;
+
+ while (pfx) {
+ pfx = strchr(pfx, '/');
+ if (pfx) {
+ pfx++;
+ strbuf_addstr(buf, "../");
+ }
+ }
+ return 0;
+}
Can we have a small common helper library (e.g., repo-info.c at the
top level) shared between this code and builtin/rev-parse.c so
that we have only a single implementation of 'cdup'?
The same comment applies to all the other features that duplicate
implementations from rev-parse and elsewhere in the repo-info file.