real_path: have callers use real_pathdup and strbuf_realpath
Migrate callers of real_path() who duplicate the retern value to use real_pathdup or strbuf_realpath. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
7241764076
commit
4ac9006f83
@ -338,7 +338,7 @@ int init_db(const char *git_dir, const char *real_git_dir,
|
||||
{
|
||||
int reinit;
|
||||
int exist_ok = flags & INIT_DB_EXIST_OK;
|
||||
char *original_git_dir = xstrdup(real_path(git_dir));
|
||||
char *original_git_dir = real_pathdup(git_dir);
|
||||
|
||||
if (real_git_dir) {
|
||||
struct stat st;
|
||||
@ -489,7 +489,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
|
||||
argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0);
|
||||
|
||||
if (real_git_dir && !is_absolute_path(real_git_dir))
|
||||
real_git_dir = xstrdup(real_path(real_git_dir));
|
||||
real_git_dir = real_pathdup(real_git_dir);
|
||||
|
||||
if (argc == 1) {
|
||||
int mkdir_tried = 0;
|
||||
@ -560,7 +560,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
|
||||
const char *git_dir_parent = strrchr(git_dir, '/');
|
||||
if (git_dir_parent) {
|
||||
char *rel = xstrndup(git_dir, git_dir_parent - git_dir);
|
||||
git_work_tree_cfg = xstrdup(real_path(rel));
|
||||
git_work_tree_cfg = real_pathdup(rel);
|
||||
free(rel);
|
||||
}
|
||||
if (!git_work_tree_cfg)
|
||||
|
Reference in New Issue
Block a user