git/builtin
Teng Long c4e2aa7d45 notes.c: introduce "--[no-]stripspace" option
This commit introduces a new option "--[no-]stripspace" to git notes
append, git notes edit, and git notes add. This option allows users to
control whether the note message need to stripped out.

For the consideration of backward compatibility, let's look at the
behavior about "stripspace" in "git notes" command:

1. "Edit Message" case: using the default editor to edit the note
message.

    In "edit" case, the edited message will always be stripped out, the
    implementation which can be found in the "prepare_note_data()". In
    addition, the "-c" option supports to reuse an existing blob as a
    note message, then open the editor to make a further edition on it,
    the edited message will be stripped.

    This commit doesn't change the default behavior of "edit" case by
    using an enum "notes_stripspace", only when "--no-stripspace" option
    is specified, the note message will not be stripped out. If you do
    not specify the option or you specify "--stripspace", clearly, the
    note message will be stripped out.

2. "Assign Message" case: using the "-m"/"-F"/"-C" option to specify the
note message.

    In "assign" case, when specify message by "-m" or "-F", the message
    will be stripped out by default, but when specify message by "-C",
    the message will be copied verbatim, in other word, the message will
    not be stripped out. One more thing need to note is "the order of
    the options matter", that is, if you specify "-C" before "-m" or
    "-F", the reused message by "-C" will be stripped out together,
    because everytime concat "-m" or "-F" message, the concated message
    will be stripped together. Oppositely, if you specify "-m" or "-F"
    before "-C", the reused message by "-C" will not be stripped out.

    This commit doesn't change the default behavior of "assign" case by
    extending the "stripspace" field in "struct note_msg", so we can
    distinguish the different behavior of "-m"/"-F" and "-C" options
    when we need to parse and concat the message.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-06-21 08:51:01 -07:00
..
add.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
am.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
annotate.c strvec: rename struct fields 2020-07-30 19:18:06 -07:00
apply.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
archive.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
bisect.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
blame.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
branch.c Merge branch 'ow/ref-filter-omit-empty' 2023-04-21 15:35:05 -07:00
bugreport.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
bundle.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
cat-file.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
check-attr.c write-or-die.h: move declarations for write-or-die.c functions from cache.h 2023-03-21 10:56:54 -07:00
check-ignore.c write-or-die.h: move declarations for write-or-die.c functions from cache.h 2023-03-21 10:56:54 -07:00
check-mailmap.c write-or-die.h: move declarations for write-or-die.c functions from cache.h 2023-03-21 10:56:54 -07:00
check-ref-format.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
checkout--worker.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
checkout-index.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
checkout.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
clean.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
clone.c Merge branch 'gc/better-error-when-local-clone-fails-with-symlink' 2023-04-20 14:33:36 -07:00
column.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
commit-graph.c environment.h: move declarations for environment.c functions from cache.h 2023-03-21 10:56:53 -07:00
commit-tree.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
commit.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
config.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
count-objects.c environment.h: move declarations for environment.c functions from cache.h 2023-03-21 10:56:53 -07:00
credential-cache--daemon.c abspath.h: move absolute path functions from cache.h 2023-03-21 10:56:52 -07:00
credential-cache.c write-or-die.h: move declarations for write-or-die.c functions from cache.h 2023-03-21 10:56:54 -07:00
credential-store.c write-or-die.h: move declarations for write-or-die.c functions from cache.h 2023-03-21 10:56:54 -07:00
credential.c builtins: mark unused prefix parameters 2023-03-28 14:11:24 -07:00
describe.c Merge branch 'rn/sparse-describe' 2023-04-21 15:35:04 -07:00
diagnose.c abspath.h: move absolute path functions from cache.h 2023-03-21 10:56:52 -07:00
diff-files.c cocci: apply "pending" index-compatibility to some "builtin/*.c" 2022-11-21 12:06:15 +09:00
diff-index.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
diff-tree.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
diff.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
difftool.c Merge branch 'tk/mergetool-gui-default-config' 2023-04-17 18:05:11 -07:00
fast-export.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
fast-import.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
fetch-pack.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
fetch.c Merge branch 'ds/fetch-bundle-uri-with-all' 2023-04-06 13:38:32 -07:00
fmt-merge-msg.c wrapper.h: move declarations for wrapper.c functions from cache.h 2023-03-21 10:56:53 -07:00
for-each-ref.c Merge branch 'ow/ref-filter-omit-empty' 2023-04-21 15:35:05 -07:00
for-each-repo.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
fsck.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
fsmonitor--daemon.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
gc.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
get-tar-commit-id.c Merge branch 'rs/get-tar-commit-id-use-defined-const' 2023-04-20 14:33:36 -07:00
grep.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
hash-object.c write-or-die.h: move declarations for write-or-die.c functions from cache.h 2023-03-21 10:56:54 -07:00
help.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
hook.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
index-pack.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
init-db.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
interpret-trailers.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
log.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
ls-files.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
ls-remote.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
ls-tree.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
mailinfo.c environment.h: move declarations for environment.c functions from cache.h 2023-03-21 10:56:53 -07:00
mailsplit.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
merge-base.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
merge-file.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
merge-index.c builtins: mark unused prefix parameters 2023-03-28 14:11:24 -07:00
merge-ours.c builtins: mark unused prefix parameters 2023-03-28 14:11:24 -07:00
merge-recursive.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
merge-tree.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
merge.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
mktag.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
mktree.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
multi-pack-index.c environment.h: move declarations for environment.c functions from cache.h 2023-03-21 10:56:53 -07:00
mv.c setup.h: move declarations for setup.c functions from cache.h 2023-03-21 10:56:54 -07:00
name-rev.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
notes.c notes.c: introduce "--[no-]stripspace" option 2023-06-21 08:51:01 -07:00
pack-objects.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
pack-redundant.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
pack-refs.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
patch-id.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
prune-packed.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
prune.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
pull.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
push.c environment.h: move declarations for environment.c functions from cache.h 2023-03-21 10:56:53 -07:00
range-diff.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
read-tree.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
rebase.c Merge branch 'pw/rebase-cleanup-merge-strategy-option-handling' 2023-04-17 18:05:13 -07:00
receive-pack.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
reflog.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
remote-ext.c builtins: annotate always-empty prefix parameters 2023-03-28 14:11:24 -07:00
remote-fd.c builtins: annotate always-empty prefix parameters 2023-03-28 14:11:24 -07:00
remote.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
repack.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
replace.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
rerere.c wrapper.h: move declarations for wrapper.c functions from cache.h 2023-03-21 10:56:53 -07:00
reset.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
rev-list.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
rev-parse.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
revert.c Merge branch 'pw/rebase-cleanup-merge-strategy-option-handling' 2023-04-17 18:05:13 -07:00
rm.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
send-pack.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
shortlog.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
show-branch.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
show-index.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
show-ref.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
sparse-checkout.c Merge branch 'ws/sparse-check-rules' 2023-04-11 13:49:12 -07:00
stash.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
stripspace.c write-or-die.h: move declarations for write-or-die.c functions from cache.h 2023-03-21 10:56:54 -07:00
submodule--helper.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
symbolic-ref.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
tag.c Merge branch 'ow/ref-filter-omit-empty' 2023-04-21 15:35:05 -07:00
unpack-file.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
unpack-objects.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
update-index.c write-or-die.h: move declarations for write-or-die.c functions from cache.h 2023-03-21 10:56:54 -07:00
update-ref.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
update-server-info.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
upload-archive.c builtins: annotate always-empty prefix parameters 2023-03-28 14:11:24 -07:00
upload-pack.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
var.c builtins: mark unused prefix parameters 2023-03-28 14:11:24 -07:00
verify-commit.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
verify-pack.c treewide: be explicit about dependence on gettext.h 2023-03-21 10:56:51 -07:00
verify-tag.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
worktree.c Merge branch 'en/header-split-cleanup' 2023-04-06 13:38:31 -07:00
write-tree.c Merge branch 'sl/sparse-write-tree' 2023-04-17 18:05:11 -07:00