took all suggestions except the one below. > > if (strbuf_getcwd(&sb)) > die_errno(...); > strbuf_addf(&sb, "/%s, sm_gitdir); > free(sm_gitdir); > sm_gitdir = strbuf_detach(&sb, NULL); > >> + } >> + >> + if (strbuf_getcwd(&sb)) >> + die_errno("unable to get current working directory"); > > The conditional block just above here also gets 'cwd'. If you move > this code above the !is_absolute_path(sm_gitdir) conditional block, > then you can avoid the duplication. I don't get it. We need to have strbuf_getcwd twice no matter how we arrange the code as we strbuf_detach will empty the strbuf. Do you mean to call strbuf_getcwd just once and then xstrdup the value, then reset the strbuf to just contain the cwd and append the other string ? > >> + strbuf_addf(&sb, "/%s", path); >> + >> + p = git_pathdup_submodule(path, "config"); >> + if (!p) >> + die("Could not get submodule directory for '%s'", path); >> + git_config_set_in_file(p, "core.worktree", >> + relative_path(sb.buf, sm_gitdir, &rel_path)); >> + strbuf_release(&sb); >> + free((char *)sm_gitdir); >> + return 0; >> +} -- 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