|
18 | 18 | #define CUTOFF_DATE_SLOP 86400 |
19 | 19 |
|
20 | 20 | struct rev_name { |
21 | | - char *tip_name; |
| 21 | + const char *tip_name; |
22 | 22 | timestamp_t taggerdate; |
23 | 23 | int generation; |
24 | 24 | int distance; |
@@ -84,7 +84,7 @@ static int commit_is_before_cutoff(struct commit *commit) |
84 | 84 |
|
85 | 85 | static int is_valid_rev_name(const struct rev_name *name) |
86 | 86 | { |
87 | | - return name && (name->generation || name->tip_name); |
| 87 | + return name && name->tip_name; |
88 | 88 | } |
89 | 89 |
|
90 | 90 | static struct rev_name *get_commit_rev_name(const struct commit *commit) |
@@ -146,20 +146,9 @@ static struct rev_name *create_or_update_name(struct commit *commit, |
146 | 146 | { |
147 | 147 | struct rev_name *name = commit_rev_name_at(&rev_names, commit); |
148 | 148 |
|
149 | | - if (is_valid_rev_name(name)) { |
150 | | - if (!is_better_name(name, taggerdate, generation, distance, from_tag)) |
151 | | - return NULL; |
152 | | - |
153 | | - /* |
154 | | - * This string might still be shared with ancestors |
155 | | - * (generation > 0). We can release it here regardless, |
156 | | - * because the new name that has just won will be better |
157 | | - * for them as well, so name_rev() will replace these |
158 | | - * stale pointers when it processes the parents. |
159 | | - */ |
160 | | - if (!name->generation) |
161 | | - free(name->tip_name); |
162 | | - } |
| 149 | + if (is_valid_rev_name(name) && |
| 150 | + !is_better_name(name, taggerdate, generation, distance, from_tag)) |
| 151 | + return NULL; |
163 | 152 |
|
164 | 153 | name->taggerdate = taggerdate; |
165 | 154 | name->generation = generation; |
|
0 commit comments