list-objects-filter: use BUG rather than die
In some cases in this file, BUG makes more sense than die. In such cases, a we get there from a coding error rather than a user error. 'return' has been removed following some instances of BUG since BUG does not return. Signed-off-by: Matthew DeVore <matvore@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthew DeVore committed
Oct 5, 2018 at 14:31 UTC
696aa73905c8c11b06735f9db830e55bc369849a
1 file changed
+4
-7
list-objects-filter.c
+4
-7
@@ -44,8 +44,7 @@ static enum list_objects_filter_result filter_blobs_none(
44
45
switch (filter_situation) {
46
default:
47
- die("unknown filter_situation");
48
- return LOFR_ZERO;
47
+ BUG("unknown filter_situation: %d", filter_situation);
48
49
case LOFS_BEGIN_TREE:
50
assert(obj->type == OBJ_TREE);
@@ -102,8 +101,7 @@ static enum list_objects_filter_result filter_blobs_limit(
101
102
switch (filter_situation) {
103
default:
105
- die("unknown filter_situation");
106
- return LOFR_ZERO;
104
+ BUG("unknown filter_situation: %d", filter_situation);
105
106
case LOFS_BEGIN_TREE:
107
assert(obj->type == OBJ_TREE);
@@ -208,8 +206,7 @@ static enum list_objects_filter_result filter_sparse(
206
207
switch (filter_situation) {
208
default:
211
- die("unknown filter_situation");
212
- return LOFR_ZERO;
209
+ BUG("unknown filter_situation: %d", filter_situation);
210
211
case LOFS_BEGIN_TREE:
212
assert(obj->type == OBJ_TREE);
@@ -389,7 +386,7 @@ void *list_objects_filter__init(
386
assert((sizeof(s_filters) / sizeof(s_filters[0])) == LOFC__COUNT);
387
388
if (filter_options->choice >= LOFC__COUNT)
392
- die("invalid list-objects filter choice: %d",
389
+ BUG("invalid list-objects filter choice: %d",
390
filter_options->choice);
391
392
init_fn = s_filters[filter_options->choice];