diff options
author | Johan Herland <johan@herland.net> | 2014-11-12 01:40:13 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-11-12 10:59:50 -0800 |
commit | 52694cdabbf68f19c8289416e7bb3bbef41d8d27 (patch) | |
tree | c353f2d10446ca0927e60b9479a9dc1eaeed75e7 /contrib/diff-highlight | |
parent | builtin/notes: simplify early exit code in add() (diff) | |
download | tgif-52694cdabbf68f19c8289416e7bb3bbef41d8d27.tar.xz |
builtin/notes: split create_note() to clarify add vs. remove logic
create_note() has a non-trivial interface, and comprises three loosely
related parts:
1. launching the editor with the note contents, if needed
2. appending to an existing note, if append_only was given
3. adding or removing the resulting note, based on whether it's non-empty
Split it along those lines to make the logic clearer: The first part
goes into a new function - prepare_note_data(), with a simpler interface.
The second part is moved into append_edit(), which is the only user of
this code. Finally, the add vs. remove decision is moved into the callers
(add() and append_edit()), keeping the logic for writing the actual note
object in a separate function: write_note_data().
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/diff-highlight')
0 files changed, 0 insertions, 0 deletions