diff options
| author | Calvin Wan <calvinwan@google.com> | 2023-06-06 19:48:43 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-06-12 13:49:36 -0700 |
| commit | 787cb8a48ae24ff07fa7c763909bb204bfdc84a7 (patch) | |
| tree | 3f5081154dbc5b8fedb73cac218d581065637bcc /builtin/branch.c | |
| parent | path: move related function to path (diff) | |
| download | git-787cb8a48ae24ff07fa7c763909bb204bfdc84a7.tar.gz git-787cb8a48ae24ff07fa7c763909bb204bfdc84a7.zip | |
strbuf: remove global variable
As a library that only interacts with other primitives, strbuf should
not utilize the comment_line_char global variable within its
functions. Therefore, add an additional parameter for functions that use
comment_line_char and refactor callers to pass it in instead.
strbuf_stripspace() removes the skip_comments boolean and checks if
comment_line_char is a non-NUL character to determine whether to skip
comments or not.
Signed-off-by: Calvin Wan <calvinwan@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/branch.c')
| -rw-r--r-- | builtin/branch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/branch.c b/builtin/branch.c index e6c2655af6..40a79e60f5 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -674,7 +674,7 @@ static int edit_branch_description(const char *branch_name) exists = !read_branch_desc(&buf, branch_name); if (!buf.len || buf.buf[buf.len-1] != '\n') strbuf_addch(&buf, '\n'); - strbuf_commented_addf(&buf, + strbuf_commented_addf(&buf, comment_line_char, _("Please edit the description for the branch\n" " %s\n" "Lines starting with '%c' will be stripped.\n"), @@ -685,7 +685,7 @@ static int edit_branch_description(const char *branch_name) strbuf_release(&buf); return -1; } - strbuf_stripspace(&buf, 1); + strbuf_stripspace(&buf, comment_line_char); strbuf_addf(&name, "branch.%s.description", branch_name); if (buf.len || exists) |
