Thread (71 messages) flat view 71 messages, 5 authors, 14h ago

Re: [GSoC Patch v5 7/7] repo: add path.cdup

From: K Jayatheerth <hidden>
Date: 2026-09-04 14:37:18

Hey Junio,

On Wed, Aug 26, 2026 at 1:01 AM Junio C Hamano [off-list ref] wrote:
K Jayatheerth [off-list ref] writes:
quoted
+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.
Apologies for the late response, I had a hectic exam week : )

I started working on this, but I wanted to check how to
structure the commits cleanly.

Would it be okay to queue this `path.*` series as-is first, and
then address the deduplication in a follow-up refactoring series
right after (provided there are no other concerns)?

Grouping the new `git repo info` keys with the cleanup of
`git rev-parse` in a single series would mix feature additions with
legacy refactoring. Additionally, since earlier path keys are
already merged, moving the shared library to a follow-up series
keeps both topics clear.

In that follow-up set, I can introduce the library alongside porting
the first command to use it, and then port the remaining overlapping
commands one by one in subsequent commits so each patch remains a
self-contained, bisectable change.

Please let me know if this works for you!

Regards,
- K Jayatheerth
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help