summaryrefslogtreecommitdiffstats
path: root/contrib/persistent-https
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-09-13 19:16:01 +0200
committerJunio C Hamano <gitster@pobox.com>2017-09-14 15:19:07 +0900
commita8811695e30e48bec0aeefe6a01ed291fd68640b (patch)
treeab7b72b07d89e64fd54a84ea2fc751372b2ba825 /contrib/persistent-https
parent36f23534aef58f747048ffea5addb0367406896d (diff)
downloadgit-a8811695e30e48bec0aeefe6a01ed291fd68640b.tar.gz
git-a8811695e30e48bec0aeefe6a01ed291fd68640b.zip
read_packed_refs(): make parsing of the header line more robust
The old code parsed the traits in the `packed-refs` header by looking for the string " trait " (i.e., the name of the trait with a space on either side) in the header line. This is fragile, because if any other implementation of Git forgets to write the trailing space, the last trait would silently be ignored (and the error might never be noticed). So instead, use `string_list_split_in_place()` to split the traits into tokens then use `unsorted_string_list_has_string()` to look for the tokens we are interested in. This means that we can read the traits correctly even if the header line is missing a trailing space (or indeed, if it is missing the space after the colon, or if it has multiple spaces somewhere). However, older Git clients (and perhaps other Git implementations) still require the surrounding spaces, so we still have to output the header with a trailing space. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions