Skip to content

Commit 696aa73

Browse files
matvoregitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 99c9aa9 commit 696aa73

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

list-objects-filter.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ static enum list_objects_filter_result filter_blobs_none(
4444

4545
switch (filter_situation) {
4646
default:
47-
die("unknown filter_situation");
48-
return LOFR_ZERO;
47+
BUG("unknown filter_situation: %d", filter_situation);
4948

5049
case LOFS_BEGIN_TREE:
5150
assert(obj->type == OBJ_TREE);
@@ -102,8 +101,7 @@ static enum list_objects_filter_result filter_blobs_limit(
102101

103102
switch (filter_situation) {
104103
default:
105-
die("unknown filter_situation");
106-
return LOFR_ZERO;
104+
BUG("unknown filter_situation: %d", filter_situation);
107105

108106
case LOFS_BEGIN_TREE:
109107
assert(obj->type == OBJ_TREE);
@@ -208,8 +206,7 @@ static enum list_objects_filter_result filter_sparse(
208206

209207
switch (filter_situation) {
210208
default:
211-
die("unknown filter_situation");
212-
return LOFR_ZERO;
209+
BUG("unknown filter_situation: %d", filter_situation);
213210

214211
case LOFS_BEGIN_TREE:
215212
assert(obj->type == OBJ_TREE);
@@ -389,7 +386,7 @@ void *list_objects_filter__init(
389386
assert((sizeof(s_filters) / sizeof(s_filters[0])) == LOFC__COUNT);
390387

391388
if (filter_options->choice >= LOFC__COUNT)
392-
die("invalid list-objects filter choice: %d",
389+
BUG("invalid list-objects filter choice: %d",
393390
filter_options->choice);
394391

395392
init_fn = s_filters[filter_options->choice];

0 commit comments

Comments
 (0)