MCPcopy Index your code
hub / github.com/git/git / add_mapping

Function add_mapping

mailmap.c:60–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60static void add_mapping(struct string_list *map,
61 char *new_name, char *new_email,
62 char *old_name, char *old_email)
63{
64 struct mailmap_entry *me;
65 struct string_list_item *item;
66
67 if (!old_email) {
68 old_email = new_email;
69 new_email = NULL;
70 }
71
72 item = string_list_insert(map, old_email);
73 if (item->util) {
74 me = (struct mailmap_entry *)item->util;
75 } else {
76 CALLOC_ARRAY(me, 1);
77 me->namemap.strdup_strings = 1;
78 me->namemap.cmp = namemap_cmp;
79 item->util = me;
80 }
81
82 if (!old_name) {
83 /* Replace current name and new email for simple entry */
84 if (new_name) {
85 free(me->name);
86 me->name = xstrdup(new_name);
87 }
88 if (new_email) {
89 free(me->email);
90 me->email = xstrdup(new_email);
91 }
92 } else {
93 struct mailmap_info *mi = xcalloc(1, sizeof(struct mailmap_info));
94 mi->name = xstrdup_or_null(new_name);
95 mi->email = xstrdup_or_null(new_email);
96 string_list_insert(&me->namemap, old_name)->util = mi;
97 }
98}
99
100static char *parse_name_and_email(char *buffer, char **name,
101 char **email, int allow_empty_email)

Callers 1

read_mailmap_lineFunction · 0.85

Calls 4

string_list_insertFunction · 0.85
xstrdupFunction · 0.85
xcallocFunction · 0.85
xstrdup_or_nullFunction · 0.85

Tested by

no test coverage detected