Merge branch 'jk/ident-gecos-strbuf'

Fixes quite a lot of brokenness when ident information needs to be taken
from the system and cleans up the code.

By Jeff King
* jk/ident-gecos-strbuf: (22 commits)
  format-patch: do not use bogus email addresses in message ids
  ident: reject bogus email addresses with IDENT_STRICT
  ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT
  format-patch: use GIT_COMMITTER_EMAIL in message ids
  ident: let callers omit name with fmt_indent
  ident: refactor NO_DATE flag in fmt_ident
  ident: reword empty ident error message
  format-patch: refactor get_patch_filename
  ident: trim whitespace from default name/email
  ident: use a dynamic strbuf in fmt_ident
  ident: use full dns names to generate email addresses
  ident: report passwd errors with a more friendly message
  drop length limitations on gecos-derived names and emails
  ident: don't write fallback username into git_default_name
  fmt_ident: drop IDENT_WARN_ON_NO_NAME code
  format-patch: use default email for generating message ids
  ident: trim trailing newline from /etc/mailname
  move git_default_* variables to ident.c
  move identity config parsing to ident.c
  fmt-merge-msg: don't use static buffer in record_person
  ...
This commit is contained in:
Junio C Hamano
2012-05-29 13:09:13 -07:00
19 changed files with 175 additions and 237 deletions

View File

@ -230,7 +230,7 @@ static void add_branch_desc(struct strbuf *out, const char *name)
static void record_person(int which, struct string_list *people,
struct commit *commit)
{
char name_buf[MAX_GITNAME], *name, *name_end;
char *name_buf, *name, *name_end;
struct string_list_item *elem;
const char *field = (which == 'a') ? "\nauthor " : "\ncommitter ";
@ -243,10 +243,9 @@ static void record_person(int which, struct string_list *people,
name_end--;
while (isspace(*name_end) && name <= name_end)
name_end--;
if (name_end < name || name + MAX_GITNAME <= name_end)
if (name_end < name)
return;
memcpy(name_buf, name, name_end - name + 1);
name_buf[name_end - name + 1] = '\0';
name_buf = xmemdupz(name, name_end - name + 1);
elem = string_list_lookup(people, name_buf);
if (!elem) {
@ -254,6 +253,7 @@ static void record_person(int which, struct string_list *people,
elem->util = (void *)0;
}
elem->util = (void*)(util_as_integral(elem) + 1);
free(name_buf);
}
static int cmp_string_list_util_as_integral(const void *a_, const void *b_)