]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'tl/notes-separator'
authorJunio C Hamano <gitster@pobox.com>
Thu, 6 Jul 2023 18:54:47 +0000 (11:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 6 Jul 2023 18:54:47 +0000 (11:54 -0700)
'git notes append' was taught '--separator' to specify string to insert
between paragraphs.

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

1  2 
builtin/notes.c

diff --cc builtin/notes.c
index fa1b91609faf34d153b255af3dae6445a8994eb3,00268e949cf9664ea9cb8d1d02e313306bf03e13..9f38863dd507ff680cf8a006b81a413d75550b1b
@@@ -7,10 -7,10 +7,11 @@@
   * and builtin/tag.c by Kristian Høgsberg and Carlos Rica.
   */
  
 -#include "cache.h"
 -#include "alloc.h"
 -#include "config.h"
  #include "builtin.h"
 +#include "config.h"
++#include "alloc.h"
 +#include "editor.h"
 +#include "environment.h"
  #include "gettext.h"
  #include "hex.h"
  #include "notes.h"
@@@ -201,7 -220,8 +224,8 @@@ static void prepare_note_data(const str
                if (launch_editor(d->edit_path, &d->buf, NULL)) {
                        die(_("please supply the note contents using either -m or -F option"));
                }
-               strbuf_stripspace(&d->buf, comment_line_char);
+               if (d->stripspace)
 -                      strbuf_stripspace(&d->buf, 1);
++                      strbuf_stripspace(&d->buf, comment_line_char);
        }
  }