grep with unmerged index
[gitweb.git] / mailmap.c
index af187a38268b7e385885b3d990a99e6de9f569ba..87141670595c50a4fa7b87a12b85ff0e2b7da8af 100644 (file)
--- a/mailmap.c
+++ b/mailmap.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "path-list.h"
+#include "mailmap.h"
 
 int read_mailmap(struct path_list *map, const char *filename, char **repo_abbrev)
 {
@@ -17,6 +18,9 @@ int read_mailmap(struct path_list *map, const char *filename, char **repo_abbrev
                        int abblen = sizeof(abbrev) - 1;
                        int len = strlen(buffer);
 
+                       if (!repo_abbrev)
+                               continue;
+
                        if (len && buffer[len - 1] == '\n')
                                buffer[--len] = 0;
                        if (!strncmp(buffer, abbrev, abblen)) {
@@ -80,9 +84,8 @@ int map_email(struct path_list *map, const char *email, char *name, int maxlen)
                free(mailbuf);
        if (item != NULL) {
                const char *realname = (const char *)item->util;
-               strncpy(name, realname, maxlen);
+               strlcpy(name, realname, maxlen);
                return 1;
        }
        return 0;
 }
-