init: avoid superfluous real_path() calls
Feeding the result of a real_path() call to real_path() again doesn't change that result -- the returned path won't get any more real. Avoid such a double call in set_git_dir_init() and for the same reason stop calling real_path() before feeding paths to set_git_work_tree(), as the latter already takes care of that. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jul 28, 2014 at 20:42 UTC
2d186c8be5bea10640927e0822bd9e1c7a2e01ea
1 file changed
+4
-4
builtin/init-db.c
+4
-4
@@ -330,12 +330,12 @@ int set_git_dir_init(const char *git_dir, const char *real_git_dir,
330
* moving the target repo later on in separate_git_dir()
331
*/
332
git_link = xstrdup(real_path(git_dir));
333
+ set_git_dir(real_path(real_git_dir));
334
}
335
else {
335
- real_git_dir = real_path(git_dir);
336
+ set_git_dir(real_path(git_dir));
337
git_link = NULL;
338
}
338
- set_git_dir(real_path(real_git_dir));
339
return 0;
340
}
341
@@ -578,7 +578,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
578
die_errno (_("Cannot access current working directory"));
579
}
580
if (work_tree)
581
- set_git_work_tree(real_path(work_tree));
581
+ set_git_work_tree(work_tree);
582
else
583
set_git_work_tree(git_work_tree_cfg);
584
if (access(get_git_work_tree(), X_OK))
@@ -587,7 +587,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
587
}
588
else {
589
if (work_tree)
590
- set_git_work_tree(real_path(work_tree));
590
+ set_git_work_tree(work_tree);
591
}
592
593
set_git_dir_init(git_dir, real_git_dir, 1);