diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-12-22 14:13:47 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-01-04 13:03:32 -0800 |
commit | 83c90314aa27ae3768c04375d02e4f3fb12b726d (patch) | |
tree | 98c2f09d1f345336613ae6551a99096b58542c33 /Documentation/technical/pack-protocol.txt | |
parent | unpack-trees.c: cosmetic fix (diff) | |
download | tgif-83c90314aa27ae3768c04375d02e4f3fb12b726d.tar.xz |
unpack_trees(): skip trees that are the same in all input
unpack_trees() merges two trees (the current HEAD and the destination
commit) when switching to another branch, checking and updating the index
entry where the destination differs from the current HEAD. It merges three
trees (the common ancestor, the current HEAD and the other commit) when
performing a three-way merge, checking and updating the index entry when
the merge result differs from the current HEAD. It does so by walking the
input trees in parallel all the way down to the leaves.
One common special case is a directory is identical across the trees
involved in the merge. In such a case, we do not have to descend into the
directory at all---we know that the end result is to keep the entries in
the current index.
This optimization cannot be applied in a few special cases in
unpack_trees(), though. We need to descend into the directory and update
the index entries from the target tree in the following cases:
- When resetting (e.g. "git reset --hard"); and
- When checking out a tree for the first time into an empty working tree
(e.g. "git read-tree -m -u HEAD HEAD" with missing .git/index).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/technical/pack-protocol.txt')
0 files changed, 0 insertions, 0 deletions