diff options
author | Jeff King <peff@peff.net> | 2017-03-28 15:46:33 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-30 14:59:50 -0700 |
commit | 6cd4a8982dbde0b6fee26faba2873c475af50a28 (patch) | |
tree | 3006f26c267aabee175f0d4342e424bbccdd4644 /t/t3504-cherry-pick-rerere.sh | |
parent | avoid using fixed PATH_MAX buffers for refs (diff) | |
download | tgif-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 't/t3504-cherry-pick-rerere.sh')
0 files changed, 0 insertions, 0 deletions