branch: add edit_description() helper
Rather than have a variable with a short name that is fed to git_path(), let's add a helper function that returns the full path. This avoids the dangerous git_path() function. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 20, 2017 at 17:08 UTC
c10388c7dc89ec4f8a6c1f7b1fd15d70e8ee0f07
1 file changed
+3
-3
builtin/branch.c
+3
-3
@@ -600,7 +600,7 @@ static void rename_branch(const char *oldname, const char *newname, int force)
600
strbuf_release(&newsection);
601
}
602
603
-static const char edit_description[] = "BRANCH_DESCRIPTION";
603
+static GIT_PATH_FUNC(edit_description, "EDIT_DESCRIPTION")
604
605
static int edit_branch_description(const char *branch_name)
606
{
@@ -615,9 +615,9 @@ static int edit_branch_description(const char *branch_name)
615
" %s\n"
616
"Lines starting with '%c' will be stripped.\n"),
617
branch_name, comment_line_char);
618
- write_file_buf(git_path(edit_description), buf.buf, buf.len);
618
+ write_file_buf(edit_description(), buf.buf, buf.len);
619
strbuf_reset(&buf);
620
- if (launch_editor(git_path(edit_description), &buf, NULL)) {
620
+ if (launch_editor(edit_description(), &buf, NULL)) {
621
strbuf_release(&buf);
622
return -1;
623
}