| 192 | } |
| 193 | |
| 194 | static void diff_tree_local(struct notes_merge_options *o, |
| 195 | struct notes_merge_pair *changes, int len, |
| 196 | const struct object_id *base, |
| 197 | const struct object_id *local) |
| 198 | { |
| 199 | struct diff_options opt; |
| 200 | int i; |
| 201 | |
| 202 | trace_printf("\tdiff_tree_local(len = %i, base = %.7s, local = %.7s)\n", |
| 203 | len, oid_to_hex(base), oid_to_hex(local)); |
| 204 | |
| 205 | repo_diff_setup(o->repo, &opt); |
| 206 | opt.flags.recursive = 1; |
| 207 | opt.output_format = DIFF_FORMAT_NO_OUTPUT; |
| 208 | diff_setup_done(&opt); |
| 209 | diff_tree_oid(base, local, "", &opt); |
| 210 | diffcore_std(&opt); |
| 211 | |
| 212 | for (i = 0; i < diff_queued_diff.nr; i++) { |
| 213 | struct diff_filepair *p = diff_queued_diff.queue[i]; |
| 214 | struct notes_merge_pair *mp; |
| 215 | int match; |
| 216 | struct object_id obj; |
| 217 | |
| 218 | if (verify_notes_filepair(p, &obj)) { |
| 219 | trace_printf("\t\tCannot merge entry '%s' (%c): " |
| 220 | "%.7s -> %.7s. Skipping!\n", p->one->path, |
| 221 | p->status, oid_to_hex(&p->one->oid), |
| 222 | oid_to_hex(&p->two->oid)); |
| 223 | continue; |
| 224 | } |
| 225 | mp = find_notes_merge_pair_pos(changes, len, &obj, 0, &match); |
| 226 | if (!match) { |
| 227 | trace_printf("\t\tIgnoring local-only change for %s: " |
| 228 | "%.7s -> %.7s\n", oid_to_hex(&obj), |
| 229 | oid_to_hex(&p->one->oid), |
| 230 | oid_to_hex(&p->two->oid)); |
| 231 | continue; |
| 232 | } |
| 233 | |
| 234 | assert(oideq(&mp->obj, &obj)); |
| 235 | if (is_null_oid(&p->two->oid)) { /* deletion */ |
| 236 | /* |
| 237 | * Either this is a true deletion (1), or it is part |
| 238 | * of an A/D pair (2), or D/A pair (3): |
| 239 | * |
| 240 | * (1) mp->local is uninitialized; set it to null_sha1 |
| 241 | * (2) mp->local is not uninitialized; don't touch it |
| 242 | * (3) mp->local is uninitialized; set it to null_sha1 |
| 243 | * (will be overwritten by following addition) |
| 244 | */ |
| 245 | if (oideq(&mp->local, &uninitialized)) |
| 246 | oidclr(&mp->local, the_repository->hash_algo); |
| 247 | } else if (is_null_oid(&p->one->oid)) { /* addition */ |
| 248 | /* |
| 249 | * Either this is a true addition (1), or it is part |
| 250 | * of an A/D pair (2), or D/A pair (3): |
| 251 | * |
no test coverage detected