summaryrefslogtreecommitdiff
path: root/worktree.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-07-09 15:43:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-12 22:11:01 (GMT)
commitfd2e7dafdeef4e9ba3c023427deb4e21ba5b31a8 (patch)
tree77389b26aad88d1bd575df2443114f989dbc189c /worktree.c
parent5c9159de87e41cf14ec5f2132afb5a06f35c26b3 (diff)
downloadgit-fd2e7dafdeef4e9ba3c023427deb4e21ba5b31a8.zip
git-fd2e7dafdeef4e9ba3c023427deb4e21ba5b31a8.tar.gz
git-fd2e7dafdeef4e9ba3c023427deb4e21ba5b31a8.tar.bz2
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>
Diffstat (limited to 'worktree.c')
-rw-r--r--worktree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/worktree.c b/worktree.c
index 199b1ef..6b4f5f3 100644
--- a/worktree.c
+++ b/worktree.c
@@ -80,7 +80,7 @@ static struct worktree *get_main_worktree(void)
int is_bare = 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");
if (is_bare)
strbuf_strip_suffix(&worktree_path, "/.");
@@ -125,7 +125,7 @@ static struct worktree *get_linked_worktree(const char *id)
strbuf_rtrim(&worktree_path);
if (!strbuf_strip_suffix(&worktree_path, "/.git")) {
strbuf_reset(&worktree_path);
- strbuf_addstr(&worktree_path, absolute_path("."));
+ strbuf_add_absolute_path(&worktree_path, ".");
strbuf_strip_suffix(&worktree_path, "/.");
}