If I use git notes --ref=$REF edit $COMMIT,original message is:
Notes (xxx):
#NEW
path/to/file1: your message
path/to/file2: your message
#TEST
path/to/file3: your message
then the message becomes
Notes (xxx):
path/to/file1: your message
path/to/file2: your message
path/to/file3: your message
How to avoid that? I want to keep “#”.
If you take a look at
builtin/notes.cin Git, you will see that it callsstripspace(&(msg->buf), 1);if it calls an editor, butstripspace(&(msg->buf), 0);if the message is passed in on the command line or via a file.stripspace(..., 1);means “skip comments”, which causes it to strip out comments as well (lines starting with#), whilestripspace(..., 0)means “don’t skip comments”, so they will be included.So it looks like the best way to create notes including a
#at the beginning of a line is to pass the note in via-m 'note contents'on the command line or-F filenameto read the note in from a file.This applies to the latest version of the code in git.git; I’ve tested with 1.8.0.