diff options
author | Jeff King <peff@peff.net> | 2012-05-21 19:10:17 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-05-22 09:08:20 -0700 |
commit | 8587ead78ad3d2af760270b21035ffe48fde3e7b (patch) | |
tree | 07ea7935298964245e4430b14d674a59eb1c9aac /commit.c | |
parent | 060d4bb3d6c0f4ca3b85f089708b07447224bc91 (diff) | |
download | git-8587ead78ad3d2af760270b21035ffe48fde3e7b.tar.gz |
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>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions