summaryrefslogtreecommitdiff
path: root/branch.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-03-28 15:46:33 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-03-30 14:59:50 -0700
commit6cd4a8982dbde0b6fee26faba2873c475af50a28 (patch)
tree3006f26c267aabee175f0d4342e424bbccdd4644 /branch.c
parentavoid using fixed PATH_MAX buffers for refs (diff)
downloadtgif-6cd4a8982dbde0b6fee26faba2873c475af50a28.tar.xz
avoid using mksnpath for refs
Like the previous commit, we'd like to avoid the assumption that refs fit into PATH_MAX-sized buffers. These callsites have an extra twist, though: they write the refnames using mksnpath. This does two things beyond a regular snprintf: 1. It quietly writes "/bad-path/" when truncation occurs. This saves the caller having to check the error code, but if you aren't actually feeding the result to a system call (and we aren't here), it's questionable. 2. It calls cleanup_path(), which removes leading instances of "./". That's questionable when dealing with refnames, as we could silently canonicalize a syntactically bogus refname into a valid one. Let's convert each case to use a strbuf. This is preferable to xstrfmt() because we can reuse the same buffer as we loop. Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'branch.c')
0 files changed, 0 insertions, 0 deletions