summaryrefslogtreecommitdiff
path: root/version.c
diff options
context:
space:
mode:
authorLibravatar Patryk Obara <patryk.obara@gmail.com>2017-08-18 20:33:14 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-08-18 12:41:06 -0700
commitcfa5bf16082e25c9221e26851ca890f71ddf5a5f (patch)
treee78e48e70eeb69d60709edffbeead39bec96b9e2 /version.c
parentcommit: allocate array using object_id size (diff)
downloadtgif-cfa5bf16082e25c9221e26851ca890f71ddf5a5f.tar.xz
commit: rewrite read_graft_line
Old implementation determined number of hashes by dividing length of line by length of hash, which works only if all hash representations have same length. New graft line parser works in two phases: 1. In first phase line is scanned to verify correctness and compute number of hashes, then graft struct is allocated. 2. In second phase line is scanned again to fill up already allocated graft struct. This way graft parsing code can support different sizes of hashes without any further code adaptations. A number of alternative implementations were considered and discarded: - Modifying graft structure to store oid_array instead of FLEXI_ARRAY indicates undesirable usage of struct to readers. - Parsing into temporary string_list or oid_array complicates code by adding more return paths, as these structures needs to be cleared before returning from function. - Determining number of hashes by counting separators might cause maintenance issues, if this function needs to be modified in future again. Signed-off-by: Patryk Obara <patryk.obara@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'version.c')
0 files changed, 0 insertions, 0 deletions