154
/* An empty entry never compares same, not even to another empty entry */
155
static int same_entry(struct name_entry *a, struct name_entry *b)
156
{
157
- return a->oid &&
158
- b->oid &&
159
- oideq(a->oid, b->oid) &&
157
+ return !is_null_oid(&a->oid) &&
158
+ !is_null_oid(&b->oid) &&
159
+ oideq(&a->oid, &b->oid) &&
160
a->mode == b->mode;
161
}
162
163
static int both_empty(struct name_entry *a, struct name_entry *b)
164
{
165
- return !(a->oid || b->oid);
165
+ return is_null_oid(&a->oid) && is_null_oid(&b->oid);
166
}
167
168
static struct merge_list *create_entry(unsigned stage, unsigned mode, const struct object_id *oid, const char *path)
178
179
static char *traverse_path(const struct traverse_info *info, const struct name_entry *n)
180
{
181
- char *path = xmallocz(traverse_path_len(info, n));
181
+ char *path = xmallocz(traverse_path_len(info, n) + the_hash_algo->rawsz);
182
return make_traverse_path(path, info, n);
183
}
184
192
return;
193
194
path = traverse_path(info, result);
195
- orig = create_entry(2, ours->mode, ours->oid, path);
196
- final = create_entry(0, result->mode, result->oid, path);
195
+ orig = create_entry(2, ours->mode, &ours->oid, path);
196
+ final = create_entry(0, result->mode, &result->oid, path);
197
198
final->link = orig;
199
217
218
newbase = traverse_path(info, p);
219
220
-#define ENTRY_OID(e) (((e)->mode && S_ISDIR((e)->mode)) ? (e)->oid : NULL)
220
+#define ENTRY_OID(e) (((e)->mode && S_ISDIR((e)->mode)) ? &(e)->oid : NULL)
221
buf0 = fill_tree_descriptor(t + 0, ENTRY_OID(n + 0));
222
buf1 = fill_tree_descriptor(t + 1, ENTRY_OID(n + 1));
223
buf2 = fill_tree_descriptor(t + 2, ENTRY_OID(n + 2));
243
path = entry->path;
244
else
245
path = traverse_path(info, n);
246
- link = create_entry(stage, n->mode, n->oid, path);
246
+ link = create_entry(stage, n->mode, &n->oid, path);
247
link->link = entry;
248
return link;
249
}
318
}
319
320
if (same_entry(entry+0, entry+1)) {
321
- if (entry[2].oid && !S_ISDIR(entry[2].mode)) {
321
+ if (!is_null_oid(&entry[2].oid) && !S_ISDIR(entry[2].mode)) {
322
/* We did not touch, they modified -- take theirs */
323
resolve(info, entry+1, entry+2);
324
return mask;