When the source file is empty, the calculation of the merge score results in a division by zero. Since the merge score is initialized to zero, it makes sense to just leave it as it is if the source size is zero. This means that we still use the extent of damage metric to decide whether to break the filepair. Signed-off-by: John Keeping <john@xxxxxxxxxxxxx> --- diffcore-break.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/diffcore-break.c b/diffcore-break.c index 44f8678..37d8d05 100644 --- a/diffcore-break.c +++ b/diffcore-break.c @@ -90,7 +90,8 @@ static int should_break(struct diff_filespec *src, * merge the surviving pair together if the score is * less than the minimum, after rename/copy runs. */ - *merge_score_p = (int)(src_removed * MAX_SCORE / src->size); + if (src->size) + *merge_score_p = (int)(src_removed * MAX_SCORE / src->size); if (*merge_score_p > break_score) return 1; -- 1.8.2.540.gf023cfe -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html