summaryrefslogtreecommitdiff
path: root/test-regex.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-06-13 12:19:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-13 18:49:40 (GMT)
commit96a1d8d34c16be8fc5acd7ceb4d34573d8e2a76b (patch)
tree91116aa899d1c5d131a36cc852d21b6a28ac7971 /test-regex.c
parent078a58e825d14987df82af9d19c00ddc8eb82481 (diff)
downloadgit-96a1d8d34c16be8fc5acd7ceb4d34573d8e2a76b.zip
git-96a1d8d34c16be8fc5acd7ceb4d34573d8e2a76b.tar.gz
git-96a1d8d34c16be8fc5acd7ceb4d34573d8e2a76b.tar.bz2
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 'test-regex.c')
0 files changed, 0 insertions, 0 deletions