diff options
author | Teng Long <dyroneteng@gmail.com> | 2023-05-27 10:57:54 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-21 18:51:01 +0300 |
commit | 3d6a31646491bf4f8b1166d7182c6d92e2414cf8 (patch) | |
tree | d598bac5d01106579a6a71381e4a95d649af739c /t | |
parent | c4e2aa7d45fadf89f6c7d7cda109eccc735a65f8 (diff) |
notes: introduce "--no-separator" option
Sometimes, the user may want to add or append multiple notes
without any separator to be added between them.
Disscussion:
https://public-inbox.org/git/3f86a553-246a-4626-b1bd-bacd8148318a@app.fastmail.com/
Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t3301-notes.sh | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index dbadcf1375..d734000d2f 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -382,6 +382,7 @@ test_expect_success 'create note with combination of -m and -F' ' ' test_expect_success 'create note with combination of -m and -F and --separator' ' + test_when_finished git notes remove HEAD && cat >expect-combine_m_and_F <<-\EOF && foo ------- @@ -395,7 +396,22 @@ test_expect_success 'create note with combination of -m and -F and --separator' EOF echo "xyzzy" >note_a && echo "zyxxy" >note_b && - git notes add -m "foo" -F note_a -m "bar" -F note_b -m "baz" --separator "-------" && + git notes add -m "foo" -F note_a -m "bar" -F note_b -m "baz" --separator="-------" && + git notes show >actual && + test_cmp expect-combine_m_and_F actual +' + +test_expect_success 'create note with combination of -m and -F and --no-separator' ' + cat >expect-combine_m_and_F <<-\EOF && + foo + xyzzy + bar + zyxxy + baz + EOF + echo "xyzzy" >note_a && + echo "zyxxy" >note_b && + git notes add -m "foo" -F note_a -m "bar" -F note_b -m "baz" --no-separator && git notes show >actual && test_cmp expect-combine_m_and_F actual ' @@ -541,7 +557,7 @@ test_expect_success 'listing non-existing notes fails' ' test_must_be_empty actual ' -test_expect_success 'append: specify an empty separator' ' +test_expect_success 'append: specify a separator with an empty arg' ' test_when_finished git notes remove HEAD && cat >expect <<-\EOF && notes-1 @@ -555,6 +571,33 @@ test_expect_success 'append: specify an empty separator' ' test_cmp expect actual ' +test_expect_success 'append: specify a separator without arg' ' + test_when_finished git notes remove HEAD && + cat >expect <<-\EOF && + notes-1 + + notes-2 + EOF + + git notes add -m "notes-1" && + git notes append --separator -m "notes-2" && + git notes show >actual && + test_cmp expect actual +' + +test_expect_success 'append: specify as --no-separator' ' + test_when_finished git notes remove HEAD && + cat >expect <<-\EOF && + notes-1 + notes-2 + EOF + + git notes add -m "notes-1" && + git notes append --no-separator -m "notes-2" && + git notes show >actual && + test_cmp expect actual +' + test_expect_success 'append: specify separator with line break' ' test_when_finished git notes remove HEAD && cat >expect <<-\EOF && @@ -615,7 +658,7 @@ test_expect_success 'append note with combination of -m and -F and --separator' echo "f-notes-1" >note_a && echo "f-notes-2" >note_b && - git notes append -m "m-notes-1" -F note_a -m "m-notes-2" -F note_b -m "m-notes-3" --separator "-------" && + git notes append -m "m-notes-1" -F note_a -m "m-notes-2" -F note_b -m "m-notes-3" --separator="-------" && git notes show >actual && test_cmp expect-combine_m_and_F actual ' |