summaryrefslogtreecommitdiff
path: root/src/diff_print.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-06-15 13:26:18 +0200
committerPatrick Steinhardt <ps@pks.im>2020-06-17 07:34:10 +0200
commitbea5fd9f44857ddae2addd543ac5cf444c1280ff (patch)
tree56aba36a232bce7bb85642ad02db88e558259aaa /src/diff_print.c
parent0cf1f444edd447aeaf61edefcaf5b31c2d611f7a (diff)
downloadlibgit2-bea5fd9f44857ddae2addd543ac5cf444c1280ff.tar.gz
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.
Diffstat (limited to 'src/diff_print.c')
-rw-r--r--src/diff_print.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/diff_print.c b/src/diff_print.c
index 8f378d9ef..afe2efae1 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -351,12 +351,11 @@ static int diff_delta_format_similarity_header(
goto done;
}
+ GIT_ASSERT(delta->status == GIT_DELTA_RENAMED || delta->status == GIT_DELTA_COPIED);
if (delta->status == GIT_DELTA_RENAMED)
type = "rename";
- else if (delta->status == GIT_DELTA_COPIED)
- type = "copy";
else
- abort();
+ type = "copy";
if ((error = git_buf_puts(&old_path, delta->old_file.path)) < 0 ||
(error = git_buf_puts(&new_path, delta->new_file.path)) < 0 ||