summaryrefslogtreecommitdiff
path: root/tree-walk.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-09-05 09:04:28 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-09-06 18:06:26 +0900
commite9ce897b9fe5a92719eb991ecc0291dd72aab868 (patch)
treedacbec3e7aa4a08afc0563c524d1820c31a1bfea /tree-walk.c
parentconfig: plug user_config leak (diff)
downloadtgif-e9ce897b9fe5a92719eb991ecc0291dd72aab868.tar.xz
reset: make tree counting less confusing
Depending on whether we're in --keep mode, git-reset may feed one or two trees to unpack_trees(). We start a counter at "1" and then increment it to "2" only for the two-tree case. But that means we must always subtract one to find the correct array slot to fill with each descriptor. Instead, let's start at "0" and just increment our counter after adding each tree. This skips the extra subtraction, and will make things much easier when we start to actually free our tree buffers. While we're at it, let's make the first allocation use the slot at "desc + nr", too, even though we know "nr" is 0 at that point. It makes the two fill_tree_descriptor() calls consistent (always "desc + nr", followed by always incrementing "nr"). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'tree-walk.c')
0 files changed, 0 insertions, 0 deletions