From: Teng Long Date: Sat, 06 May 2023 09:22:04 GMT Subject: Re: [PATCH v9 4/6] notes.c: introduce '--separator=' option Message-ID: <20230506092204.57914-1-tenglong.tl@alibaba-inc.com> In-Reply-To: <20230506091205.57746-1-tenglong.tl@alibaba-inc.com> >diff --git a/builtin/notes.c b/builtin/notes.c >index 8905298b..6eede305 100644 >--- a/builtin/notes.c >+++ b/builtin/notes.c >@@ -28,7 +28,7 @@ > #include "worktree.h" > #include "write-or-die.h" > >-static const char *separator = "\n"; >+static char *separator = "\n"; > static const char * const git_notes_usage[] = { > N_("git notes [--ref ] [list []]"), > N_("git notes [--ref ] add [-f] [--allow-empty] [--separator=] [-m | -F | (-c | -C) ] []"), >@@ -248,8 +248,8 @@ static void append_separator(struct strbuf *message) > static void concat_messages(struct note_data *d) > { > struct strbuf msg = STRBUF_INIT; >- size_t i; > >+ size_t i; > for (i = 0; i < d->msg_nr ; i++) { > if (d->buf.len) > append_separator(&d->buf); Sorry, the direction is reversed wrongly. diff --git a/builtin/notes.c b/builtin/notes.c index 6eede305..8905298b 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -28,7 +28,7 @@ #include "worktree.h" #include "write-or-die.h" -static char *separator = "\n"; +static const char *separator = "\n"; static const char * const git_notes_usage[] = { N_("git notes [--ref ] [list []]"), N_("git notes [--ref ] add [-f] [--allow-empty] [--separator=] [-m | -F | (-c | -C) ] []"), @@ -248,8 +248,8 @@ static void append_separator(struct strbuf *message) static void concat_messages(struct note_data *d) { struct strbuf msg = STRBUF_INIT; - size_t i; + for (i = 0; i < d->msg_nr ; i++) { if (d->buf.len) append_separator(&d->buf);