Diff since v4:
* Remove commits that may have compatibility issues
* Fix the problems that mentioned in v4
* Use OPT_STRING_LIST instead of OPT_CALLBACK_F to parse multiple "-m"
Thanks.
Teng Long (3):
notes.c: cleanup 'strbuf_grow' call in 'append_edit'
notes.c: cleanup for "designated init"
notes.c: introduce "--separator" option
Documentation/git-notes.txt | 12 ++++++--
builtin/notes.c | 37 ++++++++++++++++++-----
t/t3301-notes.sh | 58 +++++++++++++++++++++++++++++++++++++
3 files changed, 97 insertions(+), 10 deletions(-)
Range-diff against v4:
1: f00a7596 ! 1: 9a450669 notes.c: cleanup 'strbuf_grow' call in 'append_edit'
@@ Commit message
needed, but actually when inserting, "strbuf_insertstr(&d.buf, 0,
"\n");" will do the "grow" for us.
+ Best guess may be that the author originally inserted "\n" manually by
+ direct manipulation of the strbuf rather than employing a strbuf
+ function, but then switched to strbuf_insert() before submitting the
+ series and forgot to remove the now-unnecessary strbuf_grow().
+
Signed-off-by: Teng Long <dyroneteng@gmail.com>
+ Helped-by: Eric Sunshine <sunshine@sunshineco.com>
## builtin/notes.c ##
+@@ builtin/notes.c: static int parse_msg_arg(const struct option *opt, const char *arg, int unset)
+
+ BUG_ON_OPT_NEG(unset);
+
+- strbuf_grow(&d->buf, strlen(arg) + 2);
+ if (d->buf.len)
+ strbuf_addch(&d->buf, '\n');
+ strbuf_addstr(&d->buf, arg);
@@ builtin/notes.c: static int append_edit(int argc, const char **argv, const char *prefix)
enum object_type type;
char *prev_buf = read_object_file(note, &type, &size);
2: 29f7703b < -: -------- notes.c: cleanup for "designated init" and "char ptr init"
3: 7b756b4c < -: -------- notes.c: drop unreachable code in 'append_edit()'
4: d41ba140 < -: -------- notes.c: provide tips when target and append note are both empty
5: f7edbd0e < -: -------- notes.c: introduce "--separator" option
-: -------- > 2: e7bc6060 notes.c: cleanup for "designated init"
-: -------- > 3: a74c96d6 notes.c: introduce "--separator" option