[PATCH v9 0/6] notes.c: introduce "--separator" option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Teng Long <dyroneteng@xxxxxxxxx>

Diff since v8:

1. test case: Uniform indent format, as recommended by Junio C Hamano.

2. [4/6] make the static var "separator" initialized as "\n", simplify
   the code in "insert_separator(...)".

3. [4/6] I don't change the other parts about the "struct note_msg", the
   stripspace way (Junio suggest to consider about the stripspace each messge
   individually, but I found it will break the compatibility about "-C",
   which can be found the case of 'reuse with "-C" and add note with "-m",
   "-m" will stripspace all together').
4. [5/6] Optimized the commit message and replace "strbuf_insert*(...)" with
   "strbuf_add*(...)".

5. [6/6] As Junio replied, I'm not sure whether the "-C" problem (When the
   "-C" argument is used with "-m/-F", the order of "-C" in the options will
   affect the result of stripspace differently,) is need to be fixed or keep
   as is, I choose to do not break the old behaviour (In fact, I hope to fix
   this issue in another patch, if at all, and let this long-tailed patchset
   to mature faster, maybe).

Thanks.

Teng Long (6):
  notes.c: cleanup 'strbuf_grow' call in 'append_edit'
  notes.c: use designated initializers for clarity
  t3321: add test cases about the notes stripspace behavior
  notes.c: introduce '--separator=<paragraph-break>' option
  notes.c: append separator instead of insert by pos
  notes.c: introduce "--[no-]stripspace" option

 Documentation/git-notes.txt |  42 ++-
 builtin/notes.c             | 141 ++++++---
 t/t3301-notes.sh            | 126 ++++++++
 t/t3321-notes-stripspace.sh | 577 ++++++++++++++++++++++++++++++++++++
 4 files changed, 844 insertions(+), 42 deletions(-)
 create mode 100755 t/t3321-notes-stripspace.sh

Range-diff against v8:
1:  0634434e = 1:  0634434e notes.c: cleanup 'strbuf_grow' call in 'append_edit'
2:  4ad78405 = 2:  4ad78405 notes.c: use designated initializers for clarity
3:  6dfb5bf2 ! 3:  c2fc2091 t3321: add test cases about the notes stripspace behavior
    @@ t/t3321-notes-stripspace.sh (new)
     @@
     +#!/bin/sh
     +#
    -+# Copyright (c) 2007 Teng Long
    ++# Copyright (c) 2023 Teng Long
     +#
     +
     +test_description='Test commit notes with stripspace behavior'
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'add note by editor' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	MSG="${LF}first-line${MULTI_LF}second-line${LF}" git notes add  &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'add note by specifying single "-m"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	git notes add -m "${LF}first-line${MULTI_LF}second-line${LF}" &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'append note by editor' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	git notes add -m "first-line" &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'append note by specifying single "-m"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	git notes add -m "${LF}first-line" &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'add note by specifying single "-F"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	cat >note-file <<-EOF &&
    -+		${LF}
    -+		first-line
    -+		${MULTI_LF}
    -+		second-line
    -+		${LF}
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line
    ++	${LF}
     +	EOF
     +
     +	git notes add -F note-file &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'add notes by specifying multiple "-F"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		file-1-first-line
    ++	file-1-first-line
     +
    -+		file-1-second-line
    ++	file-1-second-line
     +
    -+		file-2-first-line
    ++	file-2-first-line
     +
    -+		file-2-second-line
    ++	file-2-second-line
     +	EOF
     +
     +	cat >note-file-1 <<-EOF &&
    -+		${LF}
    -+		file-1-first-line
    -+		${MULTI_LF}
    -+		file-1-second-line
    -+		${LF}
    ++	${LF}
    ++	file-1-first-line
    ++	${MULTI_LF}
    ++	file-1-second-line
    ++	${LF}
     +	EOF
     +
     +	cat >note-file-2 <<-EOF &&
    -+		${LF}
    -+		file-2-first-line
    -+		${MULTI_LF}
    -+		file-2-second-line
    -+		${LF}
    ++	${LF}
    ++	file-2-first-line
    ++	${MULTI_LF}
    ++	file-2-second-line
    ++	${LF}
     +	EOF
     +
     +	git notes add -F note-file-1 -F note-file-2 &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'append note by specifying single "-F"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		initial-line
    ++	initial-line
     +
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	cat >note-file <<-EOF &&
    -+		${LF}
    -+		first-line
    -+		${MULTI_LF}
    -+		second-line
    -+		${LF}
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line
    ++	${LF}
     +	EOF
     +
     +	git notes add -m "initial-line" &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'append notes by specifying multiple "-F"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		initial-line
    ++	initial-line
     +
    -+		file-1-first-line
    ++	file-1-first-line
     +
    -+		file-1-second-line
    ++	file-1-second-line
     +
    -+		file-2-first-line
    ++	file-2-first-line
     +
    -+		file-2-second-line
    ++	file-2-second-line
     +	EOF
     +
     +	cat >note-file-1 <<-EOF &&
    -+		${LF}
    -+		file-1-first-line
    -+		${MULTI_LF}
    -+		file-1-second-line
    -+		${LF}
    ++	${LF}
    ++	file-1-first-line
    ++	${MULTI_LF}
    ++	file-1-second-line
    ++	${LF}
     +	EOF
     +
     +	cat >note-file-2 <<-EOF &&
    -+		${LF}
    -+		file-2-first-line
    -+		${MULTI_LF}
    -+		file-2-second-line
    -+		${LF}
    ++	${LF}
    ++	file-2-first-line
    ++	${MULTI_LF}
    ++	file-2-second-line
    ++	${LF}
     +	EOF
     +
     +	git notes add -m "initial-line" &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'add note by specifying "-C" , do not stripspace is the default behavior' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		${LF}
    -+		first-line
    -+		${MULTI_LF}
    -+		second-line
    -+		${LF}
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line
    ++	${LF}
     +	EOF
     +
     +	cat expect | git hash-object -w --stdin >blob &&
    @@ t/t3321-notes-stripspace.sh (new)
     +test_expect_success 'add notes with "-C" and "-m", "-m" will stripspace all together' '
     +	test_when_finished "git notes remove" &&
     +	cat >data <<-EOF &&
    -+		${LF}
    -+		first-line
    -+		${MULTI_LF}
    -+		second-line
    -+		${LF}
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line
    ++	${LF}
     +	EOF
     +
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +
    -+		third-line
    ++	third-line
     +	EOF
     +
     +	cat data | git hash-object -w --stdin >blob &&
    @@ t/t3321-notes-stripspace.sh (new)
     +	test_when_finished "git notes remove" &&
     +	cat >data <<-EOF &&
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	cat >expect <<-EOF &&
    -+		first-line
    -+		${LF}
    -+		second-line
    ++	first-line
    ++	${LF}
    ++	second-line
     +	EOF
     +
     +	cat data | git hash-object -w --stdin >blob &&
4:  be86f9ca ! 4:  ed930ef4 notes.c: introduce '--separator=<paragraph-break>' option
    @@ Commit message
         insert a blank line between the paragraphs, like:
     
              $ git notes add -m foo -m bar
    -         $ git notes show HEAD | cat
    +         $ git notes show HEAD
              foo
     
              bar
    @@ Commit message
         'git notes append', for example when executing:
     
             $ git notes add -m foo -m bar --separator="-"
    -        $ git notes show HEAD | cat
    +        $ git notes show HEAD
             foo
             -
             bar
    @@ builtin/notes.c
      #include "worktree.h"
      #include "write-or-die.h"
      
    -+static char *separator = NULL;
    ++static char *separator = "\n";
      static const char * const git_notes_usage[] = {
      	N_("git notes [--ref <notes-ref>] [list [<object>]]"),
     -	N_("git notes [--ref <notes-ref>] add [-f] [--allow-empty] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]"),
    @@ builtin/notes.c: static void free_note_data(struct note_data *d)
      	}
      	strbuf_release(&d->buf);
     +
    -+	while (d->msg_nr) {
    -+		--d->msg_nr;
    ++	while (d->msg_nr--) {
     +		strbuf_release(&d->messages[d->msg_nr]->buf);
     +		free(d->messages[d->msg_nr]);
     +	}
    @@ builtin/notes.c: static void write_note_data(struct note_data *d, struct object_
      
     +static void insert_separator(struct strbuf *message, size_t pos)
     +{
    -+	if (!separator)
    -+		strbuf_insertstr(message, pos, "\n");
    -+	else if (separator[strlen(separator) - 1] == '\n')
    -+		strbuf_insertstr(message, pos, separator);
    ++	if (separator[strlen(separator) - 1] == '\n')
    ++		strbuf_addstr(message, separator);
     +	else
     +		strbuf_insertf(message, pos, "%s%s", separator, "\n");
     +}
5:  ef40e0ef ! 5:  eea2246f notes.c: append separator instead of insert by pos
    @@ Metadata
      ## Commit message ##
         notes.c: append separator instead of insert by pos
     
    -    This commit rename "insert_separator" to "append_separator" and also
    -    remove the "postion" argument, this serves two purpose:
    +    Rename "insert_separator" to "append_separator" and also remove the
    +    "postion" argument, this serves two purpose:
     
         The first is that when specifying more than one "-m" ( like "-F", etc)
         to "git notes add" or "git notes append", the order of them matters,
    @@ Commit message
         so we don't have to make the caller specify the position, the "append"
         operation is enough and clear.
     
    -    The second is that when we execute the "git notes append" subcommand
    -    , we need to combine the "prev_note" and "current_note" to get the
    +    The second is that when we execute the "git notes append" subcommand,
    +    we need to combine the "prev_note" and "current_note" to get the
         final result. Before, we inserted a newline character at the beginning
         of "current_note". Now, we will append a newline to the end of
         "prev_note" instead, this will give the consisitent results.
    @@ builtin/notes.c: static void write_note_data(struct note_data *d, struct object_
     -static void insert_separator(struct strbuf *message, size_t pos)
     +static void append_separator(struct strbuf *message)
      {
    - 	if (!separator)
    --		strbuf_insertstr(message, pos, "\n");
    -+		strbuf_insertstr(message, message->len, "\n");
    - 	else if (separator[strlen(separator) - 1] == '\n')
    --		strbuf_insertstr(message, pos, separator);
    -+		strbuf_insertstr(message, message->len, separator);
    + 	if (separator[strlen(separator) - 1] == '\n')
    + 		strbuf_addstr(message, separator);
      	else
     -		strbuf_insertf(message, pos, "%s%s", separator, "\n");
    -+		strbuf_insertf(message, message->len, "%s%s", separator, "\n");
    ++		strbuf_addf(message, "%s%s", separator, "\n");
      }
      
      static void concat_messages(struct note_data *d)
6:  f60f7432 ! 6:  20063bea notes.c: introduce "--[no-]stripspace" option
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add note by editor' '
     +test_expect_success 'add note by specifying single "-m", "--stripspace" is the default behavior' '
      	test_when_finished "git notes remove" &&
      	cat >expect <<-EOF &&
    - 		first-line
    + 	first-line
     @@ t/t3321-notes-stripspace.sh: test_expect_success 'add note by specifying single "-m"' '
      
      	git notes add -m "${LF}first-line${MULTI_LF}second-line${LF}" &&
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add note by specifying single
     +test_expect_success 'add note by specifying single "-m" and "--no-stripspace" ' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		${LF}first-line${MULTI_LF}second-line
    ++	${LF}first-line${MULTI_LF}second-line
     +	EOF
     +
     +	git notes add --no-stripspace \
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add note by specifying multipl
      	test_cmp expect actual
      '
      
    --
    --test_expect_success 'append note by editor' '
     +test_expect_success 'add notes by specifying multiple "-m" and "--no-stripspace"' '
    - 	test_when_finished "git notes remove" &&
    - 	cat >expect <<-EOF &&
    -+		${LF}
    - 		first-line
    --
    --		second-line
    -+		${MULTI_LF}
    -+		second-line${LF}
    - 	EOF
    - 
    --	git notes add -m "first-line" &&
    --	MSG="${MULTI_LF}second-line${LF}" git notes append  &&
    ++	test_when_finished "git notes remove" &&
    ++	cat >expect <<-EOF &&
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line${LF}
    ++	EOF
    ++
     +	git notes add --no-stripspace \
     +		      -m "${LF}" \
     +		      -m "first-line" \
     +		      -m "${MULTI_LF}" \
     +		      -m "second-line" \
     +		      -m "${LF}" &&
    - 	git notes show >actual &&
    - 	test_cmp expect actual
    - '
    - 
    --test_expect_success 'append note by specifying single "-m"' '
    -+test_expect_success 'add note by specifying single "-F", "--stripspace" is the default behavior' '
    - 	test_when_finished "git notes remove" &&
    - 	cat >expect <<-EOF &&
    - 		first-line
    -@@ t/t3321-notes-stripspace.sh: test_expect_success 'append note by specifying single "-m"' '
    - 		second-line
    - 	EOF
    - 
    --	git notes add -m "${LF}first-line" &&
    --	git notes append -m "${MULTI_LF}second-line${LF}" &&
    --	git notes show >actual &&
    --	test_cmp expect actual
    --'
    --
    --test_expect_success 'append note by specifying multiple "-m"' '
    --	test_when_finished "git notes remove" &&
    --	cat >expect <<-EOF &&
    --	first-line
    --
    --	second-line
    -+	cat >note-file <<-EOF &&
    -+		${LF}
    -+		first-line
    -+		${MULTI_LF}
    -+		second-line
    -+		${LF}
    - 	EOF
    - 
    --	git notes add -m "${LF}first-line" &&
    --	git notes append -m "${MULTI_LF}" \
    --		      -m "second-line" \
    --		      -m "${LF}" &&
    -+	git notes add -F note-file &&
    - 	git notes show >actual &&
    --	test_cmp expect actual
    -+	test_cmp expect actual &&
    -+	git notes remove &&
    -+	git notes add --stripspace -F note-file &&
    -+	git notes show >actual
    - '
    - 
    --test_expect_success 'add note by specifying single "-F"' '
    -+test_expect_success 'add note by specifying single "-F" and "--no-stripspace"' '
    - 	test_when_finished "git notes remove" &&
    - 	cat >expect <<-EOF &&
    -+		${LF}
    - 		first-line
    --
    -+		${MULTI_LF}
    - 		second-line
    -+		${LF}
    - 	EOF
    - 
    - 	cat >note-file <<-EOF &&
    -@@ t/t3321-notes-stripspace.sh: test_expect_success 'add note by specifying single "-F"' '
    - 		${LF}
    - 	EOF
    - 
    --	git notes add -F note-file &&
    -+	git notes add --no-stripspace -F note-file &&
    - 	git notes show >actual &&
    - 	test_cmp expect actual
    - '
    - 
    --test_expect_success 'add notes by specifying multiple "-F"' '
    -+test_expect_success 'add note by specifying multiple "-F", "--stripspace" is the default behavior' '
    - 	test_when_finished "git notes remove" &&
    - 	cat >expect <<-EOF &&
    - 		file-1-first-line
    -@@ t/t3321-notes-stripspace.sh: test_expect_success 'add notes by specifying multiple "-F"' '
    - 
    - 	git notes add -F note-file-1 -F note-file-2 &&
    - 	git notes show >actual &&
    -+	test_cmp expect actual &&
    -+	git notes remove &&
    -+	git notes add --stripspace -F note-file-1 -F note-file-2 &&
     +	git notes show >actual &&
     +	test_cmp expect actual
     +'
     +
    -+test_expect_success 'add note by specifying multiple "-F" with "--no-stripspace"' '
    ++test_expect_success 'add note by specifying single "-F", "--stripspace" is the default behavior' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		${LF}
    -+		file-1-first-line
    -+		${MULTI_LF}
    -+		file-1-second-line
    -+		${LF}
    -+
    -+		${LF}
    -+		file-2-first-line
    -+		${MULTI_LF}
    -+		file-2-second-line
    -+		${LF}
    -+	EOF
    ++	first-line
     +
    -+	cat >note-file-1 <<-EOF &&
    -+		${LF}
    -+		file-1-first-line
    -+		${MULTI_LF}
    -+		file-1-second-line
    -+		${LF}
    ++	second-line
     +	EOF
     +
    -+	cat >note-file-2 <<-EOF &&
    -+		${LF}
    -+		file-2-first-line
    -+		${MULTI_LF}
    -+		file-2-second-line
    -+		${LF}
    ++	cat >note-file <<-EOF &&
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line
    ++	${LF}
     +	EOF
     +
    -+	git notes add --no-stripspace -F note-file-1 -F note-file-2 &&
    ++	git notes add -F note-file &&
     +	git notes show >actual &&
    -+	test_cmp expect actual
    ++	test_cmp expect actual &&
    ++	git notes remove &&
    ++	git notes add --stripspace -F note-file &&
    ++	git notes show >actual
     +'
     +
    -+test_expect_success 'append note by editor' '
    ++test_expect_success 'add note by specifying single "-F" and "--no-stripspace"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line
    ++	${LF}
    ++	EOF
     +
    -+		second-line
    ++	cat >note-file <<-EOF &&
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line
    ++	${LF}
     +	EOF
     +
    -+	git notes add -m "first-line" &&
    -+	MSG="${MULTI_LF}second-line${LF}" git notes append  &&
    ++	git notes add --no-stripspace -F note-file &&
     +	git notes show >actual &&
     +	test_cmp expect actual
     +'
     +
    -+test_expect_success 'append note by specifying single "-m"' '
    ++test_expect_success 'add note by specifying multiple "-F", "--stripspace" is the default behavior' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	file-1-first-line
    ++
    ++	file-1-second-line
    ++
    ++	file-2-first-line
     +
    -+		second-line
    ++	file-2-second-line
    ++	EOF
    ++
    ++	cat >note-file-1 <<-EOF &&
    ++	${LF}
    ++	file-1-first-line
    ++	${MULTI_LF}
    ++	file-1-second-line
    ++	${LF}
    ++	EOF
    ++
    ++	cat >note-file-2 <<-EOF &&
    ++	${LF}
    ++	file-2-first-line
    ++	${MULTI_LF}
    ++	file-2-second-line
    ++	${LF}
     +	EOF
     +
    -+	git notes add -m "${LF}first-line" &&
    -+	git notes append -m "${MULTI_LF}second-line${LF}" &&
    ++	git notes add -F note-file-1 -F note-file-2 &&
    ++	git notes show >actual &&
    ++	test_cmp expect actual &&
    ++	git notes remove &&
    ++	git notes add --stripspace -F note-file-1 -F note-file-2 &&
     +	git notes show >actual &&
     +	test_cmp expect actual
     +'
     +
    -+test_expect_success 'append note by specifying multiple "-m"' '
    ++test_expect_success 'add note by specifying multiple "-F" with "--no-stripspace"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+	first-line
    ++	${LF}
    ++	file-1-first-line
    ++	${MULTI_LF}
    ++	file-1-second-line
    ++	${LF}
    ++
    ++	${LF}
    ++	file-2-first-line
    ++	${MULTI_LF}
    ++	file-2-second-line
    ++	${LF}
    ++	EOF
     +
    -+	second-line
    ++	cat >note-file-1 <<-EOF &&
    ++	${LF}
    ++	file-1-first-line
    ++	${MULTI_LF}
    ++	file-1-second-line
    ++	${LF}
    ++	EOF
    ++
    ++	cat >note-file-2 <<-EOF &&
    ++	${LF}
    ++	file-2-first-line
    ++	${MULTI_LF}
    ++	file-2-second-line
    ++	${LF}
     +	EOF
     +
    -+	git notes add -m "${LF}first-line" &&
    -+	git notes append -m "${MULTI_LF}" -m "second-line" -m "${LF}" &&
    ++	git notes add --no-stripspace -F note-file-1 -F note-file-2 &&
     +	git notes show >actual &&
    - 	test_cmp expect actual
    - '
    ++	test_cmp expect actual
    ++'
      
    + test_expect_success 'append note by editor' '
    + 	test_when_finished "git notes remove" &&
     @@ t/t3321-notes-stripspace.sh: test_expect_success 'append notes by specifying multiple "-F"' '
      	test_cmp expect actual
      '
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'append notes by specifying mul
     +test_expect_success 'append note by specifying multiple "-F" with "--no-stripspace"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		initial-line
    -+		${LF}${LF}
    -+		file-1-first-line
    -+		${MULTI_LF}
    -+		file-1-second-line
    -+		${LF}
    -+
    -+		${LF}
    -+		file-2-first-line
    -+		${MULTI_LF}
    -+		file-2-second-line
    -+		${LF}
    ++	initial-line
    ++	${LF}${LF}
    ++	file-1-first-line
    ++	${MULTI_LF}
    ++	file-1-second-line
    ++	${LF}
    ++
    ++	${LF}
    ++	file-2-first-line
    ++	${MULTI_LF}
    ++	file-2-second-line
    ++	${LF}
     +	EOF
     +
     +	cat >note-file-1 <<-EOF &&
    -+		${LF}
    -+		file-1-first-line
    -+		${MULTI_LF}
    -+		file-1-second-line
    -+		${LF}
    ++	${LF}
    ++	file-1-first-line
    ++	${MULTI_LF}
    ++	file-1-second-line
    ++	${LF}
     +	EOF
     +
     +	cat >note-file-2 <<-EOF &&
    -+		${LF}
    -+		file-2-first-line
    -+		${MULTI_LF}
    -+		file-2-second-line
    -+		${LF}
    ++	${LF}
    ++	file-2-first-line
    ++	${MULTI_LF}
    ++	file-2-second-line
    ++	${LF}
     +	EOF
     +
     +	git notes add -m "initial-line" &&
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add notes with empty messages'
     +test_expect_success 'add note by specifying "-C", "--no-stripspace" is the default behavior' '
      	test_when_finished "git notes remove" &&
      	cat >expect <<-EOF &&
    - 		${LF}
    + 	${LF}
     @@ t/t3321-notes-stripspace.sh: test_expect_success 'add note by specifying "-C" , do not stripspace is the defa
      	cat expect | git hash-object -w --stdin >blob &&
      	git notes add -C $(cat blob) &&
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add note by specifying "-C" ,
     +test_expect_success 'reuse note by specifying "-C" and "--stripspace"' '
     +	test_when_finished "git notes remove" &&
     +	cat >data <<-EOF &&
    -+		${LF}
    -+		first-line
    -+		${MULTI_LF}
    -+		second-line
    -+		${LF}
    ++	${LF}
    ++	first-line
    ++	${MULTI_LF}
    ++	second-line
    ++	${LF}
     +	EOF
     +
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	cat data | git hash-object -w --stdin >blob &&
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add note by specifying "-C" ,
     +test_expect_success 'reuse with "-C" and add note with "-m", "-m" will stripspace all together' '
      	test_when_finished "git notes remove" &&
      	cat >data <<-EOF &&
    - 		${LF}
    + 	${LF}
     @@ t/t3321-notes-stripspace.sh: test_expect_success 'add notes with "-C" and "-m", "-m" will stripspace all toge
      	test_cmp expect actual
      '
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add notes with "-m" and "-C",
     +test_expect_success 'add note by specifying "-c", "--stripspace" is the default behavior' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	echo "initial-line" | git hash-object -w --stdin >blob &&
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add notes with "-m" and "-C",
     +test_expect_success 'add note by specifying "-c" with "--no-stripspace"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		${LF}first-line${MULTI_LF}second-line${LF}
    ++	${LF}first-line${MULTI_LF}second-line${LF}
     +	EOF
     +
     +	echo "initial-line" | git hash-object -w --stdin >blob &&
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add notes with "-m" and "-C",
     +test_expect_success 'edit note by specifying "-c", "--stripspace" is the default behavior' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		first-line
    ++	first-line
     +
    -+		second-line
    ++	second-line
     +	EOF
     +
     +	MSG="${LF}first-line${MULTI_LF}second-line${LF}" git notes edit &&
    @@ t/t3321-notes-stripspace.sh: test_expect_success 'add notes with "-m" and "-C",
     +test_expect_success 'edit note by specifying "-c" with "--no-stripspace"' '
     +	test_when_finished "git notes remove" &&
     +	cat >expect <<-EOF &&
    -+		${LF}first-line${MULTI_LF}second-line${LF}
    ++	${LF}first-line${MULTI_LF}second-line${LF}
     +	EOF
     +
     +	MSG="${LF}first-line${MULTI_LF}second-line${LF}" git notes add --no-stripspace &&
-- 
2.40.0.358.g2947072e.dirty




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux