3
3
#include "mailmap.h"
4
4
#include "object-store.h"
5
5
6
- #define DEBUG_MAILMAP 0
7
- #if DEBUG_MAILMAP
8
- #define debug_mm (...) fprintf(stderr, __VA_ARGS__)
9
- #define debug_str (X ) ((X) ? (X) : "(none)")
10
- #else
11
- __attribute__((format (printf , 1 , 2 )))
12
- static inline void debug_mm (const char * format , ...) {}
13
- static inline const char * debug_str (const char * s ) { return s ; }
14
- #endif
15
-
16
6
const char * git_mailmap_file ;
17
7
const char * git_mailmap_blob ;
18
8
@@ -30,23 +20,17 @@ struct mailmap_entry {
30
20
struct string_list namemap ;
31
21
};
32
22
33
- static void free_mailmap_info (void * p , const char * s )
23
+ static void free_mailmap_info (void * p , const char * s UNUSED )
34
24
{
35
25
struct mailmap_info * mi = (struct mailmap_info * )p ;
36
- debug_mm ("mailmap: -- complex: '%s' -> '%s' <%s>\n" ,
37
- s , debug_str (mi -> name ), debug_str (mi -> email ));
38
26
free (mi -> name );
39
27
free (mi -> email );
40
28
free (mi );
41
29
}
42
30
43
- static void free_mailmap_entry (void * p , const char * s )
31
+ static void free_mailmap_entry (void * p , const char * s UNUSED )
44
32
{
45
33
struct mailmap_entry * me = (struct mailmap_entry * )p ;
46
- debug_mm ("mailmap: removing entries for <%s>, with %" PRIuMAX " sub-entries\n" ,
47
- s , (uintmax_t )me -> namemap .nr );
48
- debug_mm ("mailmap: - simple: '%s' <%s>\n" ,
49
- debug_str (me -> name ), debug_str (me -> email ));
50
34
51
35
free (me -> name );
52
36
free (me -> email );
@@ -93,8 +77,6 @@ static void add_mapping(struct string_list *map,
93
77
}
94
78
95
79
if (!old_name ) {
96
- debug_mm ("mailmap: adding (simple) entry for '%s'\n" , old_email );
97
-
98
80
/* Replace current name and new email for simple entry */
99
81
if (new_name ) {
100
82
free (me -> name );
@@ -106,15 +88,10 @@ static void add_mapping(struct string_list *map,
106
88
}
107
89
} else {
108
90
struct mailmap_info * mi = xcalloc (1 , sizeof (struct mailmap_info ));
109
- debug_mm ("mailmap: adding (complex) entry for '%s'\n" , old_email );
110
91
mi -> name = xstrdup_or_null (new_name );
111
92
mi -> email = xstrdup_or_null (new_email );
112
93
string_list_insert (& me -> namemap , old_name )-> util = mi ;
113
94
}
114
-
115
- debug_mm ("mailmap: '%s' <%s> -> '%s' <%s>\n" ,
116
- debug_str (old_name ), old_email ,
117
- debug_str (new_name ), debug_str (new_email ));
118
95
}
119
96
120
97
static char * parse_name_and_email (char * buffer , char * * name ,
@@ -250,11 +227,8 @@ int read_mailmap(struct string_list *map)
250
227
251
228
void clear_mailmap (struct string_list * map )
252
229
{
253
- debug_mm ("mailmap: clearing %" PRIuMAX " entries...\n" ,
254
- (uintmax_t )map -> nr );
255
230
map -> strdup_strings = 1 ;
256
231
string_list_clear_func (map , free_mailmap_entry );
257
- debug_mm ("mailmap: cleared\n" );
258
232
}
259
233
260
234
/*
@@ -315,10 +289,6 @@ int map_user(struct string_list *map,
315
289
struct string_list_item * item ;
316
290
struct mailmap_entry * me ;
317
291
318
- debug_mm ("map_user: map '%.*s' <%.*s>\n" ,
319
- (int )* namelen , debug_str (* name ),
320
- (int )* emaillen , debug_str (* email ));
321
-
322
292
item = lookup_prefix (map , * email , * emaillen );
323
293
if (item ) {
324
294
me = (struct mailmap_entry * )item -> util ;
@@ -336,10 +306,8 @@ int map_user(struct string_list *map,
336
306
}
337
307
if (item ) {
338
308
struct mailmap_info * mi = (struct mailmap_info * )item -> util ;
339
- if (mi -> name == NULL && mi -> email == NULL ) {
340
- debug_mm ("map_user: -- (no simple mapping)\n" );
309
+ if (mi -> name == NULL && mi -> email == NULL )
341
310
return 0 ;
342
- }
343
311
if (mi -> email ) {
344
312
* email = mi -> email ;
345
313
* emaillen = strlen (* email );
@@ -348,11 +316,7 @@ int map_user(struct string_list *map,
348
316
* name = mi -> name ;
349
317
* namelen = strlen (* name );
350
318
}
351
- debug_mm ("map_user: to '%.*s' <%.*s>\n" ,
352
- (int )* namelen , debug_str (* name ),
353
- (int )* emaillen , debug_str (* email ));
354
319
return 1 ;
355
320
}
356
- debug_mm ("map_user: --\n" );
357
321
return 0 ;
358
322
}
0 commit comments