drop length limitations on gecos-derived names and emails
commit8587ead78ad3d2af760270b21035ffe48fde3e7b
authorJeff King <peff@peff.net>
Mon, 21 May 2012 23:10:17 +0000 (21 19:10 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 May 2012 16:08:20 +0000 (22 09:08 -0700)
tree07ea7935298964245e4430b14d674a59eb1c9aac
parent060d4bb3d6c0f4ca3b85f089708b07447224bc91
drop length limitations on gecos-derived names and emails

When we pull the user's name from the GECOS field of the
passwd file (or generate an email address based on their
username and hostname), we put the result into a
static buffer. While it's extremely unlikely that anybody
ever hit these limits (after all, in such a case their
parents must have hated them), we still had to deal with the
error cases in our code.

Converting these static buffers to strbufs lets us simplify
the code and drop some error messages from the documentation
that have confused some users.

The conversion is mostly mechanical: replace string copies
with strbuf equivalents, and access the strbuf.buf directly.
There are a few exceptions:

  - copy_gecos and copy_email are the big winners in code
    reduction (since they no longer have to manage the
    string length manually)

  - git_ident_config wants to replace old versions of
    the default name (e.g., if we read the config multiple
    times), so it must reset+add to the strbuf instead of
    just adding

Note that there is still one length limitation: the
gethostname interface requires us to provide a static
buffer, so we arbitrarily choose 1024 bytes for the
hostname.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-commit-tree.txt
Documentation/git-var.txt
ident.c