Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-28 22:46:33 +0300
committerJunio C Hamano <gitster@pobox.com>2017-03-31 00:59:50 +0300
commit6cd4a8982dbde0b6fee26faba2873c475af50a28 (patch)
tree3006f26c267aabee175f0d4342e424bbccdd4644 /branch.c
parent7f897b6f176319ec0f490d286c3fee11187d7095 (diff)
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