Merge branch 'ct/diff-with-merge-base-clarification' into master

Recent update to "git diff" meant as a code clean-up introduced a
bug in its error handling code, which has been corrected.

* ct/diff-with-merge-base-clarification:
  diff: check for merge bases before assigning sym->base
This commit is contained in:
Junio C Hamano
2020-07-09 14:00:43 -07:00

View File

@ -355,9 +355,9 @@ static void symdiff_prepare(struct rev_info *rev, struct symdiff *sym)
sym->left = rev->pending.objects[lpos].name; sym->left = rev->pending.objects[lpos].name;
sym->right = rev->pending.objects[rpos].name; sym->right = rev->pending.objects[rpos].name;
sym->base = rev->pending.objects[basepos].name;
if (basecount == 0) if (basecount == 0)
die(_("%s...%s: no merge base"), sym->left, sym->right); die(_("%s...%s: no merge base"), sym->left, sym->right);
sym->base = rev->pending.objects[basepos].name;
bitmap_unset(map, basepos); /* unmark the base we want */ bitmap_unset(map, basepos); /* unmark the base we want */
sym->warn = basecount > 1; sym->warn = basecount > 1;
sym->skip = map; sym->skip = map;