Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  git-send-email.txt: move --format-patch paragraph to a proper location
  git-shortlog.txt: improve documentation about .mailmap files
  pretty: support multiline subjects with format:
  pretty: factor out format_subject()
  pretty: factor out skip_empty_lines()
  merge-file: handle freopen() failure
  daemon: cleanup: factor out xstrdup_tolower()
  daemon: cleanup: replace loop with if
  daemon: handle freopen() failure
  describe: Avoid unnecessary warning when using --all
  • Loading branch information
Junio C Hamano committed Dec 27, 2008
2 parents 78f8fbc + a9012e3 commit 159c88e
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 97 deletions.
12 changes: 6 additions & 6 deletions Documentation/git-send-email.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,6 @@ Administering
--[no-]validate::
Perform sanity checks on patches.
Currently, validation means the following:

--[no-]format-patch::
When an argument may be understood either as a reference or as a file name,
choose to understand it as a format-patch argument ('--format-patch')
or as a file name ('--no-format-patch'). By default, when such a conflict
occurs, git send-email will fail.
+
--
* Warn of patches that contain lines longer than 998 characters; this
Expand All @@ -212,6 +206,12 @@ Administering
Default is the value of 'sendemail.validate'; if this is not set,
default to '--validate'.

--[no-]format-patch::
When an argument may be understood either as a reference or as a file name,
choose to understand it as a format-patch argument ('--format-patch')
or as a file name ('--no-format-patch'). By default, when such a conflict
occurs, git send-email will fail.


CONFIGURATION
-------------
Expand Down
40 changes: 33 additions & 7 deletions Documentation/git-shortlog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,41 @@ OPTIONS
FILES
-----

If the file `.mailmap` exists, it will be used for mapping author
email addresses to a real author name. One mapping per line, first
the author name followed by the email address enclosed by
'<' and '>'. Use hash '#' for comments. Example:
If a file `.mailmap` exists at the toplevel of the repository,
it is used to map an author email address to a canonical real name. This
can be used to coalesce together commits by the same person where their
name was spelled differently (whether with the same email address or
not).

Each line in the file consists, in this order, of the canonical real name
of an author, whitespace, and an email address (enclosed by '<' and '>')
to map to the name. Use hash '#' for comments, either on their own line,
or after the email address.

A canonical name may appear in more than one line, associated with
different email addresses, but it doesn't make sense for a given address
to appear more than once (if that happens, a later line overrides the
earlier ones).

So, for example, if your history contains commits by two authors, Jane
and Joe, whose names appear in the repository under several forms:

------------
Joe Developer <joe@example.com>
Joe R. Developer <joe@example.com>
Jane Doe <jane@example.com>
Jane Doe <jane@laptop.(none)>
Jane D. <jane@desktop.(none)>
------------

Then, supposing Joe wants his middle name initial used, and Jane prefers
her family name fully spelled out, a proper `.mailmap` file would look like:

------------
# Keep alphabetized
Adam Morrow <adam@localhost.localdomain>
Eve Jones <eve@laptop.(none)>
# Note how we don't need an entry for <jane@laptop.(none)>, because the
# real name of that author is correct already, and coalesced directly.
Jane Doe <jane@desktop.(none)>
Joe R. Developer <joe@random.com>
------------

Author
Expand Down
2 changes: 1 addition & 1 deletion builtin-describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static void display_name(struct commit_name *n)
n->tag = lookup_tag(n->sha1);
if (!n->tag || parse_tag(n->tag) || !n->tag->tag)
die("annotated tag %s not available", n->path);
if (strcmp(n->tag->tag, n->path))
if (strcmp(n->tag->tag, all ? n->path + 5 : n->path))
warning("tag '%s' is really '%s' here", n->tag->tag, n->path);
}

Expand Down
7 changes: 5 additions & 2 deletions builtin-merge-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, options, merge_file_usage, 0);
if (argc != 3)
usage_with_options(merge_file_usage, options);
if (quiet)
freopen("/dev/null", "w", stderr);
if (quiet) {
if (!freopen("/dev/null", "w", stderr))
return error("failed to redirect stderr to /dev/null: "
"%s\n", strerror(errno));
}

for (i = 0; i < 3; i++) {
if (!names[i])
Expand Down
56 changes: 21 additions & 35 deletions daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ static char *path_ok(char *directory)
{
static char rpath[PATH_MAX];
static char interp_path[PATH_MAX];
int retried_path = 0;
char *path;
char *dir;

Expand Down Expand Up @@ -219,22 +218,15 @@ static char *path_ok(char *directory)
dir = rpath;
}

do {
path = enter_repo(dir, strict_paths);
if (path)
break;

path = enter_repo(dir, strict_paths);
if (!path && base_path && base_path_relaxed) {
/*
* if we fail and base_path_relaxed is enabled, try without
* prefixing the base path
*/
if (base_path && base_path_relaxed && !retried_path) {
dir = directory;
retried_path = 1;
continue;
}
break;
} while (1);
dir = directory;
path = enter_repo(dir, strict_paths);
}

if (!path) {
logerror("'%s': unable to chdir or not a git archive", dir);
Expand Down Expand Up @@ -405,6 +397,14 @@ static void make_service_overridable(const char *name, int ena)
die("No such service %s", name);
}

static char *xstrdup_tolower(const char *str)
{
char *p, *dup = xstrdup(str);
for (p = dup; *p; p++)
*p = tolower(*p);
return dup;
}

/*
* Separate the "extra args" information as supplied by the client connection.
*/
Expand All @@ -413,7 +413,6 @@ static void parse_extra_args(char *extra_args, int buflen)
char *val;
int vallen;
char *end = extra_args + buflen;
char *hp;

while (extra_args < end && *extra_args) {
saw_extended_args = 1;
Expand All @@ -431,28 +430,19 @@ static void parse_extra_args(char *extra_args, int buflen)
tcp_port = xstrdup(port);
}
free(hostname);
hostname = xstrdup(host);
hostname = xstrdup_tolower(host);
}

/* On to the next one */
extra_args = val + vallen;
}
}

/*
* Replace literal host with lowercase-ized hostname.
*/
hp = hostname;
if (!hp)
return;
for ( ; *hp; hp++)
*hp = tolower(*hp);

/*
* Locate canonical hostname and its IP address.
*/
if (hostname) {
#ifndef NO_IPV6
{
struct addrinfo hints;
struct addrinfo *ai, *ai0;
int gai;
Expand All @@ -476,9 +466,7 @@ static void parse_extra_args(char *extra_args, int buflen)
}
freeaddrinfo(ai0);
}
}
#else
{
struct hostent *hent;
struct sockaddr_in sa;
char **ap;
Expand All @@ -499,8 +487,8 @@ static void parse_extra_args(char *extra_args, int buflen)
canon_hostname = xstrdup(hent->h_name);
free(ip_address);
ip_address = xstrdup(addrbuf);
}
#endif
}
}


Expand Down Expand Up @@ -953,12 +941,8 @@ int main(int argc, char **argv)
char *arg = argv[i];

if (!prefixcmp(arg, "--listen=")) {
char *p = arg + 9;
char *ph = listen_addr = xmalloc(strlen(arg + 9) + 1);
while (*p)
*ph++ = tolower(*p++);
*ph = 0;
continue;
listen_addr = xstrdup_tolower(arg + 9);
continue;
}
if (!prefixcmp(arg, "--port=")) {
char *end;
Expand Down Expand Up @@ -1118,7 +1102,9 @@ int main(int argc, char **argv)
struct sockaddr *peer = (struct sockaddr *)&ss;
socklen_t slen = sizeof(ss);

freopen("/dev/null", "w", stderr);
if (!freopen("/dev/null", "w", stderr))
die("failed to redirect stderr to /dev/null: %s",
strerror(errno));

if (getpeername(0, peer, &slen))
peer = NULL;
Expand Down
Loading

0 comments on commit 159c88e

Please sign in to comment.