Skip to content

Commit e8e4ce7

Browse files
committed
Merge branch 'rs/init-no-duplicate-real-path'
* rs/init-no-duplicate-real-path: init: avoid superfluous real_path() calls
2 parents 1d8a6f6 + 2d186c8 commit e8e4ce7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

builtin/init-db.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,12 @@ int set_git_dir_init(const char *git_dir, const char *real_git_dir,
330330
* moving the target repo later on in separate_git_dir()
331331
*/
332332
git_link = xstrdup(real_path(git_dir));
333+
set_git_dir(real_path(real_git_dir));
333334
}
334335
else {
335-
real_git_dir = real_path(git_dir);
336+
set_git_dir(real_path(git_dir));
336337
git_link = NULL;
337338
}
338-
set_git_dir(real_path(real_git_dir));
339339
return 0;
340340
}
341341

@@ -578,7 +578,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
578578
die_errno (_("Cannot access current working directory"));
579579
}
580580
if (work_tree)
581-
set_git_work_tree(real_path(work_tree));
581+
set_git_work_tree(work_tree);
582582
else
583583
set_git_work_tree(git_work_tree_cfg);
584584
if (access(get_git_work_tree(), X_OK))
@@ -587,7 +587,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
587587
}
588588
else {
589589
if (work_tree)
590-
set_git_work_tree(real_path(work_tree));
590+
set_git_work_tree(work_tree);
591591
}
592592

593593
set_git_dir_init(git_dir, real_git_dir, 1);

0 commit comments

Comments
 (0)