Refactor notes code to concatenate multiple notes annotating the same object
commitef8db638cc96abaf166bbafe31752219f3d2cdc2
authorJohan Herland <johan@herland.net>
Fri, 9 Oct 2009 10:22:09 +0000 (9 12:22 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 20 Oct 2009 02:00:24 +0000 (19 19:00 -0700)
tree4377d731875a2f2712697f39f9608dfde6f2d90b
parent0057c0917d35f9f21e01f2122e7f2b9f169a8b02
Refactor notes code to concatenate multiple notes annotating the same object

Currently, having multiple notes referring to the same commit from various
locations in the notes tree is strongly discouraged, since only one of those
notes will be parsed and shown.

This patch teaches the notes code to _concatenate_ multiple notes that
annotate the same commit. Notes are concatenated by creating a new blob
object containing the concatenation of the notes in question, and
replacing them with the concatenated note in the internal notes tree
structure.

Getting the concatenation right requires being more proactive in unpacking
subtree entries in the internal notes tree structure, so that we don't return
a note prematurely (i.e. before having found all other notes that annotate
the same object). As such, this patch may incur a small performance penalty.

Suggested-by: Sam Vilain <sam@vilain.net>
Re-suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
notes.c