Merge branch 'rs/worktree-use-strbuf-absolute-path'

Code simplification.

* rs/worktree-use-strbuf-absolute-path:
  worktree: use strbuf_add_absolute_path() directly
This commit is contained in:
Junio C Hamano 2016-07-25 14:13:37 -07:00
Родитель 03f25e85d9 fd2e7dafde
Коммит fc08d2d4ad
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -80,7 +80,7 @@ static struct worktree *get_main_worktree(void)
int is_bare = 0; int is_bare = 0;
int is_detached = 0; int is_detached = 0;
strbuf_addstr(&worktree_path, absolute_path(get_git_common_dir())); strbuf_add_absolute_path(&worktree_path, get_git_common_dir());
is_bare = !strbuf_strip_suffix(&worktree_path, "/.git"); is_bare = !strbuf_strip_suffix(&worktree_path, "/.git");
if (is_bare) if (is_bare)
strbuf_strip_suffix(&worktree_path, "/."); strbuf_strip_suffix(&worktree_path, "/.");
@ -125,7 +125,7 @@ static struct worktree *get_linked_worktree(const char *id)
strbuf_rtrim(&worktree_path); strbuf_rtrim(&worktree_path);
if (!strbuf_strip_suffix(&worktree_path, "/.git")) { if (!strbuf_strip_suffix(&worktree_path, "/.git")) {
strbuf_reset(&worktree_path); strbuf_reset(&worktree_path);
strbuf_addstr(&worktree_path, absolute_path(".")); strbuf_add_absolute_path(&worktree_path, ".");
strbuf_strip_suffix(&worktree_path, "/."); strbuf_strip_suffix(&worktree_path, "/.");
} }