Skip to content

Commit bea5fd9

Browse files
committed
diff_print: do not call abort(3P)
Calling abort(3P) in a library is rather rude and shouldn't happen, as we effectively prohibit any corrective actions made by the application linking to it. We thus shouldn't call it at all, but instead use our new `GIT_ASSERT` macros. Remove the call to abort(3P) in case a diff delta has an unexpected type to fix this.
1 parent 0cf1f44 commit bea5fd9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/diff_print.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,11 @@ static int diff_delta_format_similarity_header(
351351
goto done;
352352
}
353353

354+
GIT_ASSERT(delta->status == GIT_DELTA_RENAMED || delta->status == GIT_DELTA_COPIED);
354355
if (delta->status == GIT_DELTA_RENAMED)
355356
type = "rename";
356-
else if (delta->status == GIT_DELTA_COPIED)
357-
type = "copy";
358357
else
359-
abort();
358+
type = "copy";
360359

361360
if ((error = git_buf_puts(&old_path, delta->old_file.path)) < 0 ||
362361
(error = git_buf_puts(&new_path, delta->new_file.path)) < 0 ||

0 commit comments

Comments
 (0)