diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2014-06-13 19:19:40 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-13 11:49:40 -0700 |
commit | 96a1d8d34c16be8fc5acd7ceb4d34573d8e2a76b (patch) | |
tree | 91116aa899d1c5d131a36cc852d21b6a28ac7971 /git-cvsexportcommit.perl | |
parent | read-cache: mark updated entries for split index (diff) | |
download | tgif-96a1d8d34c16be8fc5acd7ceb4d34573d8e2a76b.tar.xz |
split-index: the writing part
prepare_to_write_split_index() does the major work, classifying
deleted, updated and added entries. write_link_extension() then just
writes it down.
An observation is, deleting an entry, then adding it back is recorded
as "entry X is deleted, entry X is added", not "entry X is replaced".
This is simpler, with small overhead: a replaced entry is stored
without its path, a new entry is store with its path.
A note about unpack_trees() and the deduplication code inside
prepare_to_write_split_index(). Usually tracking updated/removed
entries via read-cache API is enough. unpack_trees() manipulates the
index in a different way: it throws the entire source index out,
builds up a new one, copying/duplicating entries (using dup_entry)
from the source index over if necessary, then returns the new index.
A naive solution would be marking the entire source index "deleted"
and add their duplicates as new. That could bring $GIT_DIR/index back
to the original size. So we try harder and memcmp() between the
original and the duplicate to see if it needs updating.
We could avoid memcmp() too, by avoiding duplicating the original
entry in dup_entry(). The performance gain this way is within noise
level and it complicates unpack-trees.c. So memcmp() is the preferred
way to deal with deduplication.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-cvsexportcommit.perl')
0 files changed, 0 insertions, 0 deletions