Code

fast-import: Proper notes tree manipulation
authorJohan Herland <johan@herland.net>
Mon, 7 Dec 2009 11:27:24 +0000 (12:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Dec 2009 21:52:52 +0000 (13:52 -0800)
commit2a113aee9ba6ba55fc9a4c714efc958ab0de6510
tree8470e636ab8301d35da6044fab4c79201ced3e36
parent488bdf2ebe6e99fb30ad958a710b0b3f737b4d0f
fast-import: Proper notes tree manipulation

This patch teaches 'git fast-import' to automatically organize note objects
in a fast-import stream into an appropriate fanout structure. The notes API
in notes.h is NOT used to accomplish this, because trying to keep the
fast-import and notes data structures in sync would yield a significantly
larger patch with higher complexity.

Note objects are added with the 'N' command, and accounted for with a
per-branch counter, which is used to trigger fanout restructuring when
needed. Note that when restructuring the branch tree, _any_ entry whose
path consists of 40 hex chars (not including directory separators) will
be recognized as a note object. It is therefore not advisable to
manipulate note entries with M/D/R/C commands.

Since note objects are stored in the same tree structure as other objects,
the unloading and reloading of a fast-import branches handle note objects
transparently.

This patch has been improved by the following contributions:
- Shawn O. Pearce: Several style- and logic-related improvements

Cc: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fast-import.c
t/t9300-fast-import.sh