Code

Merge with master
authorJonas Fonseca <fonseca@diku.dk>
Sun, 25 Mar 2007 09:10:14 +0000 (11:10 +0200)
committerJonas Fonseca <fonseca@diku.dk>
Sun, 25 Mar 2007 09:10:14 +0000 (11:10 +0200)
1  2 
Makefile
tig.c

diff --cc Makefile
index 9d8c57ba761983a8f8b11cae0df8ea22b4d07fc4,9d8c57ba761983a8f8b11cae0df8ea22b4d07fc4..0052abd39095f1b3d7098557160af96a8a2f3898
+++ b/Makefile
@@@ -4,7 -4,7 +4,7 @@@ mandir = $(prefix)/ma
  docdir = $(prefix)/share/doc
  # DESTDIR=
  
--LDLIBS  = -lcurses
++LDLIBS  = -lcurses -liconv
  CFLAGS        = -Wall -O2
  DFLAGS        = -g -DDEBUG -Werror
  PROGS = tig
diff --cc tig.c
index 1983375ca03a517a6d1408b2488c8814cc4d5a31,affbcec1bd520248604a337524b2e5e6caf3ecdc..8deab13773e0646d6269c71077103e10e79574b8
--- 1/tig.c
--- 2/tig.c
+++ b/tig.c
@@@ -3044,32 -2827,24 +3048,27 @@@ main_read(struct view *view, char *line
  
        case LINE_AUTHOR:
        {
+               /* Parse author lines where the name may be empty:
+                *      author  <email@address.tld> 1138474660 +0100
+                */
                char *ident = line + STRING_SIZE("author ");
-               char *end = strchr(ident, '<');
+               char *nameend = strchr(ident, '<');
+               char *emailend = strchr(ident, '>');
  
-               if (!commit)
+               if (!commit || !nameend || !emailend)
                        break;
  
-               if (end) {
-                       char *email = end + 1;
-                       for (; end > ident && isspace(end[-1]); end--) ;
-                       if (end == ident && *email) {
-                               ident = email;
-                               end = strchr(ident, '>');
-                               for (; end > ident && isspace(end[-1]); end--) ;
-                       }
-                       *end = 0;
 +              update_rev_graph(graph);
 +              graph = graph->next;
 +
+               *nameend = *emailend = 0;
+               ident = chomp_string(ident);
+               if (!*ident) {
+                       ident = chomp_string(nameend + 1);
+                       if (!*ident)
+                               ident = "Unknown";
                }
  
-               /* End is NULL or ident meaning there's no author. */
-               if (end <= ident)
-                       ident = "Unknown";
                string_copy(commit->author, ident);
  
                /* Parse epoch and timezone */