summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-08-10 09:37:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-10 22:37:14 (GMT)
commit0ea68e429647cc5400fe8fa257056083b0a6459d (patch)
treee7bf8ddf1a1f6400f74ef3f3a82fae58434f3cd1 /attr.c
parent03f2c7731b59de75357730bc511ffa8847e1fb81 (diff)
downloadgit-0ea68e429647cc5400fe8fa257056083b0a6459d.zip
git-0ea68e429647cc5400fe8fa257056083b0a6459d.tar.gz
git-0ea68e429647cc5400fe8fa257056083b0a6459d.tar.bz2
get_repo_path: refactor path-allocation
The get_repo_path function calls mkpath() and then does some non-trivial operations on it, like calling is_git_directory() and read_gitfile(). These are actually OK (they do not use more pathname static buffers themselves), but it takes a fair bit of work to verify. Let's use our own strbuf to store the path, and we can simply reuse it for each iteration of the loop (we can even avoid rewriting the beginning part, since we are trying a series of suffixes). To make the strbuf cleanup easier, we split out a thin wrapper. As a bonus, this wrapper can factor out the canonicalization that happens in all of the early-return code paths. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'attr.c')
0 files changed, 0 insertions, 0 deletions