{"thread":{"id":"42809","subject":"[PATCH] worktree: use strbuf_add_absolute_path() directly","startedAt":"2016-07-09T15:44:14Z","lastAt":"2016-07-09T15:44:14Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"291107","messageId":"57811BBF.3020101@web.de","threadId":"42809","inReplyTo":null,"subject":"[PATCH] worktree: use strbuf_add_absolute_path() directly","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2016-07-09T15:43:59Z","receivedAt":"2016-07-09T15:44:14Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"absolute_path() is a wrapper for strbuf_add_absolute_path().  Call the\nlatter directly for adding absolute paths to a strbuf.  That's shorter\nand avoids an extra string copy.\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n worktree.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/worktree.c b/worktree.c\nindex e2a94e0..b819baf 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -80,7 +80,7 @@ static struct worktree *get_main_worktree(void)\n \tint is_bare = 0;\n \tint is_detached = 0;\n \n-\tstrbuf_addstr(&worktree_path, absolute_path(get_git_common_dir()));\n+\tstrbuf_add_absolute_path(&worktree_path, get_git_common_dir());\n \tis_bare = !strbuf_strip_suffix(&worktree_path, \"/.git\");\n \tif (is_bare)\n \t\tstrbuf_strip_suffix(&worktree_path, \"/.\");\n@@ -125,7 +125,7 @@ static struct worktree *get_linked_worktree(const char *id)\n \tstrbuf_rtrim(&worktree_path);\n \tif (!strbuf_strip_suffix(&worktree_path, \"/.git\")) {\n \t\tstrbuf_reset(&worktree_path);\n-\t\tstrbuf_addstr(&worktree_path, absolute_path(\".\"));\n+\t\tstrbuf_add_absolute_path(&worktree_path, \".\");\n \t\tstrbuf_strip_suffix(&worktree_path, \"/.\");\n \t}\n \n-- \n2.9.0\n\n"}]}