diff options
| author | Junio C Hamano <gitster@pobox.com> | 2017-01-18 15:12:11 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-01-18 15:12:11 -0800 |
| commit | 55d128ae06b7b82f867961b677984620612a201c (patch) | |
| tree | 5628d92c5a897c1738ae99b360d303a2ac62409e /setup.c | |
| parent | ffac48d093d4b518a0cc0e8bf1b7cb53e0c3d7a2 (diff) | |
| parent | e6fac7f3d3e313a93fe9b1243917669267b33153 (diff) | |
| download | git-55d128ae06b7b82f867961b677984620612a201c.tar.gz | |
Merge branch 'bw/grep-recurse-submodules'
"git grep" has been taught to optionally recurse into submodules.
* bw/grep-recurse-submodules:
grep: search history of moved submodules
grep: enable recurse-submodules to work on <tree> objects
grep: optionally recurse into submodules
grep: add submodules as a grep source type
submodules: load gitmodules file from commit sha1
submodules: add helper to determine if a submodule is initialized
submodules: add helper to determine if a submodule is populated
real_path: canonicalize directory separators in root parts
real_path: have callers use real_pathdup and strbuf_realpath
real_path: create real_pathdup
real_path: convert real_path_internal to strbuf_realpath
real_path: resolve symlinks by hand
Diffstat (limited to 'setup.c')
| -rw-r--r-- | setup.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -256,8 +256,10 @@ int get_common_dir_noenv(struct strbuf *sb, const char *gitdir) strbuf_addbuf(&path, &data); strbuf_addstr(sb, real_path(path.buf)); ret = 1; - } else + } else { strbuf_addstr(sb, gitdir); + } + strbuf_release(&data); strbuf_release(&path); return ret; @@ -692,7 +694,7 @@ static const char *setup_discovered_git_dir(const char *gitdir, /* --work-tree is set without --git-dir; use discovered one */ if (getenv(GIT_WORK_TREE_ENVIRONMENT) || git_work_tree_cfg) { if (offset != cwd->len && !is_absolute_path(gitdir)) - gitdir = xstrdup(real_path(gitdir)); + gitdir = real_pathdup(gitdir); if (chdir(cwd->buf)) die_errno("Could not come back to cwd"); return setup_explicit_git_dir(gitdir, cwd, nongit_ok); @@ -800,11 +802,12 @@ static int canonicalize_ceiling_entry(struct string_list_item *item, /* Keep entry but do not canonicalize it */ return 1; } else { - const char *real_path = real_path_if_valid(ceil); - if (!real_path) + char *real_path = real_pathdup(ceil); + if (!real_path) { return 0; + } free(item->string); - item->string = xstrdup(real_path); + item->string = real_path; return 1; } } |
