]> git.ipfire.org Git - thirdparty/git.git/commit - branch.c
create_branch: use xstrfmt for reflog message
authorJeff King <peff@peff.net>
Tue, 28 Mar 2017 19:46:40 +0000 (15:46 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Mar 2017 21:59:50 +0000 (14:59 -0700)
commitcddac45219b70f121d30468811a9fbee78fa24f2
tree6f0f57c9b801b94cb310c7d8142b73652213c662
parent3818b258dc145aae25c48cf4fca830be0cb69c6e
create_branch: use xstrfmt for reflog message

We generate a reflog message that contains some fixed text
plus a branch name, and use a buffer of size PATH_MAX + 20.
This mostly works if you assume that refnames are shorter
than PATH_MAX, but:

  1. That's not necessarily true. PATH_MAX is not always the
     filesystem's limit.

  2. The "20" is not sufficiently large for the fixed text
     anyway.

Let's just switch to a heap buffer so we don't have to even
care.

Signed-off-by: Jeff King <peff@peff.net>
branch.c