summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-04-20 17:08:41 -0400
committerJunio C Hamano <gitster@pobox.com>2017-04-20 21:03:13 -0700
commitc10388c7dc89ec4f8a6c1f7b1fd15d70e8ee0f07 (patch)
tree0d17204876a3c8bb39f67a59350636c7326df1ac
parentf5d284f6df5413f1fcdf2c92bbf0e8523298c483 (diff)
downloadgit-c10388c7dc89ec4f8a6c1f7b1fd15d70e8ee0f07.tar.gz
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>
-rw-r--r--builtin/branch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index babfd0f730..c55ea58040 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -600,7 +600,7 @@ static void rename_branch(const char *oldname, const char *newname, int force)
strbuf_release(&newsection);
}
-static const char edit_description[] = "BRANCH_DESCRIPTION";
+static GIT_PATH_FUNC(edit_description, "EDIT_DESCRIPTION")
static int edit_branch_description(const char *branch_name)
{
@@ -615,9 +615,9 @@ static int edit_branch_description(const char *branch_name)
" %s\n"
"Lines starting with '%c' will be stripped.\n"),
branch_name, comment_line_char);
- write_file_buf(git_path(edit_description), buf.buf, buf.len);
+ write_file_buf(edit_description(), buf.buf, buf.len);
strbuf_reset(&buf);
- if (launch_editor(git_path(edit_description), &buf, NULL)) {
+ if (launch_editor(edit_description(), &buf, NULL)) {
strbuf_release(&buf);
return -1;
}