Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> writes: > diff --git a/setup.c b/setup.c > index f512ea0..ffc30bf 100644 > --- a/setup.c > +++ b/setup.c > @@ -7,6 +7,25 @@ static int inside_work_tree = -1; > const char *prefix_path(const char *prefix, int len, const char *path) > { > const char *orig = path; > + const char *work_tree = get_git_work_tree(); > + if (is_absolute_path(path) && work_tree) { Could you structure this part to read like this, into a separate function: static const char *strip_work_tree_path(const char *prefix, int len, const char *path) { ... } const char *prefix_path(const char *prefix, int len, const char *path) { const char *orig = path; if (is_absolute_path(path)) path = strip_work_tree_path(prefix, len, path); ... About the part that would be moved out of line with such a restructuring, > + int n = strlen(work_tree); > + if (!strncmp(path, work_tree, n) && (path[n] == '/' || !path[n])) { > + if (path[n]) > + path += n + 1; > + else > + path += n; > + > + if (prefix && !strncmp(path, prefix, len - 1)) { > + if (path[len - 1] == '/') > + path += len; > + else > + if (!path[len - 1]) > + path += len - 1; > + } This makes me wonder what happens if after stripping the worktree path path does not match the prefix. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html