Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Wan <calvinwan@google.com>2023-06-06 22:48:43 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-12 23:49:36 +0300
commit787cb8a48ae24ff07fa7c763909bb204bfdc84a7 (patch)
tree3f5081154dbc5b8fedb73cac218d581065637bcc /rebase-interactive.c
parentaba070683295a20bdf4f49146384984961c794b2 (diff)
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 'rebase-interactive.c')
-rw-r--r--rebase-interactive.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/rebase-interactive.c b/rebase-interactive.c
index 852a331318..f286404d4b 100644
--- a/rebase-interactive.c
+++ b/rebase-interactive.c
@@ -72,13 +72,14 @@ void append_todo_help(int command_count,
if (!edit_todo) {
strbuf_addch(buf, '\n');
- strbuf_commented_addf(buf, Q_("Rebase %s onto %s (%d command)",
- "Rebase %s onto %s (%d commands)",
- command_count),
+ strbuf_commented_addf(buf, comment_line_char,
+ Q_("Rebase %s onto %s (%d command)",
+ "Rebase %s onto %s (%d commands)",
+ command_count),
shortrevisions, shortonto, command_count);
}
- strbuf_add_commented_lines(buf, msg, strlen(msg));
+ strbuf_add_commented_lines(buf, msg, strlen(msg), comment_line_char);
if (get_missing_commit_check_level() == MISSING_COMMIT_CHECK_ERROR)
msg = _("\nDo not remove any line. Use 'drop' "
@@ -87,7 +88,7 @@ void append_todo_help(int command_count,
msg = _("\nIf you remove a line here "
"THAT COMMIT WILL BE LOST.\n");
- strbuf_add_commented_lines(buf, msg, strlen(msg));
+ strbuf_add_commented_lines(buf, msg, strlen(msg), comment_line_char);
if (edit_todo)
msg = _("\nYou are editing the todo file "
@@ -98,7 +99,7 @@ void append_todo_help(int command_count,
msg = _("\nHowever, if you remove everything, "
"the rebase will be aborted.\n\n");
- strbuf_add_commented_lines(buf, msg, strlen(msg));
+ strbuf_add_commented_lines(buf, msg, strlen(msg), comment_line_char);
}
int edit_todo_list(struct repository *r, struct todo_list *todo_list,
@@ -130,7 +131,7 @@ int edit_todo_list(struct repository *r, struct todo_list *todo_list,
if (launch_sequence_editor(todo_file, &new_todo->buf, NULL))
return -2;
- strbuf_stripspace(&new_todo->buf, 1);
+ strbuf_stripspace(&new_todo->buf, comment_line_char);
if (initial && new_todo->buf.len == 0)
return -3;