worktree: use strbuf_add_absolute_path() directly
absolute_path() is a wrapper for strbuf_add_absolute_path(). Call the latter directly for adding absolute paths to a strbuf. That's shorter and avoids an extra string copy. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jul 9, 2016 at 17:43 UTC
fd2e7dafdeef4e9ba3c023427deb4e21ba5b31a8
1 file changed
+2
-2
worktree.c
+2
-2
@@ -80,7 +80,7 @@ static struct worktree *get_main_worktree(void)
80
int is_bare = 0;
81
int is_detached = 0;
82
83
- strbuf_addstr(&worktree_path, absolute_path(get_git_common_dir()));
83
+ strbuf_add_absolute_path(&worktree_path, get_git_common_dir());
84
is_bare = !strbuf_strip_suffix(&worktree_path, "/.git");
85
if (is_bare)
86
strbuf_strip_suffix(&worktree_path, "/.");
@@ -125,7 +125,7 @@ static struct worktree *get_linked_worktree(const char *id)
125
strbuf_rtrim(&worktree_path);
126
if (!strbuf_strip_suffix(&worktree_path, "/.git")) {
127
strbuf_reset(&worktree_path);
128
- strbuf_addstr(&worktree_path, absolute_path("."));
128
+ strbuf_add_absolute_path(&worktree_path, ".");
129
strbuf_strip_suffix(&worktree_path, "/.");
130
}
131