summaryrefslogtreecommitdiff
path: root/pack-revindex.c
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-02-13 22:28:19 +0100
committerJunio C Hamano <gitster@pobox.com>2010-02-13 19:36:13 -0800
commit73f464b5f3fe4dd5109b9fb9e58c1fe55393902d (patch)
tree02d1d26e0057bae465de2167ef76e6dfcff3eecc /pack-revindex.c
parentcd30539214bb09881b84c796a50d30e409dee3fa (diff)
downloadgit-73f464b5f3fe4dd5109b9fb9e58c1fe55393902d.tar.gz
Refactor notes concatenation into a flexible interface for combining notes
When adding a note to an object that already has an existing note, the current solution is to concatenate the contents of the two notes. However, the caller may instead wish to _overwrite_ the existing note with the new note, or maybe even _ignore_ the new note, and keep the existing one. There might also be other ways of combining notes that are only known to the caller. Therefore, instead of unconditionally concatenating notes, we let the caller specify how to combine notes, by passing in a pointer to a function for combining notes. The caller may choose to implement its own function for notes combining, but normally one of the following three conveniently supplied notes combination functions will be sufficient: - combine_notes_concatenate() combines the two notes by appending the contents of the new note to the contents of the existing note. - combine_notes_overwrite() replaces the existing note with the new note. - combine_notes_ignore() keeps the existing note, and ignores the new note. A combine_notes function can be passed to init_notes() to choose a default combine_notes function for that notes tree. If NULL is given, the notes tree falls back to combine_notes_concatenate() as the ultimate default. A combine_notes function can also be passed directly to add_note(), to control the notes combining behaviour for a note addition in particular. If NULL is passed, the combine_notes function registered for the given notes tree is used. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-revindex.c')
0 files changed, 0 insertions, 0 deletions