]> git.ipfire.org Git - thirdparty/git.git/blobdiff - list-objects-filter.c
list-objects: support filtering by tag and commit
[thirdparty/git.git] / list-objects-filter.c
index 39e2f15333694933468f6af9bea6d9804251dfcb..0ebfa5296625a32258a91670877e1c72509047fe 100644 (file)
@@ -82,6 +82,16 @@ static enum list_objects_filter_result filter_blobs_none(
        default:
                BUG("unknown filter_situation: %d", filter_situation);
 
+       case LOFS_TAG:
+               assert(obj->type == OBJ_TAG);
+               /* always include all tag objects */
+               return LOFR_MARK_SEEN | LOFR_DO_SHOW;
+
+       case LOFS_COMMIT:
+               assert(obj->type == OBJ_COMMIT);
+               /* always include all commit objects */
+               return LOFR_MARK_SEEN | LOFR_DO_SHOW;
+
        case LOFS_BEGIN_TREE:
                assert(obj->type == OBJ_TREE);
                /* always include all tree objects */
@@ -173,6 +183,16 @@ static enum list_objects_filter_result filter_trees_depth(
        default:
                BUG("unknown filter_situation: %d", filter_situation);
 
+       case LOFS_TAG:
+               assert(obj->type == OBJ_TAG);
+               /* always include all tag objects */
+               return LOFR_MARK_SEEN | LOFR_DO_SHOW;
+
+       case LOFS_COMMIT:
+               assert(obj->type == OBJ_COMMIT);
+               /* always include all commit objects */
+               return LOFR_MARK_SEEN | LOFR_DO_SHOW;
+
        case LOFS_END_TREE:
                assert(obj->type == OBJ_TREE);
                filter_data->current_depth--;
@@ -267,6 +287,16 @@ static enum list_objects_filter_result filter_blobs_limit(
        default:
                BUG("unknown filter_situation: %d", filter_situation);
 
+       case LOFS_TAG:
+               assert(obj->type == OBJ_TAG);
+               /* always include all tag objects */
+               return LOFR_MARK_SEEN | LOFR_DO_SHOW;
+
+       case LOFS_COMMIT:
+               assert(obj->type == OBJ_COMMIT);
+               /* always include all commit objects */
+               return LOFR_MARK_SEEN | LOFR_DO_SHOW;
+
        case LOFS_BEGIN_TREE:
                assert(obj->type == OBJ_TREE);
                /* always include all tree objects */
@@ -371,6 +401,16 @@ static enum list_objects_filter_result filter_sparse(
        default:
                BUG("unknown filter_situation: %d", filter_situation);
 
+       case LOFS_TAG:
+               assert(obj->type == OBJ_TAG);
+               /* always include all tag objects */
+               return LOFR_MARK_SEEN | LOFR_DO_SHOW;
+
+       case LOFS_COMMIT:
+               assert(obj->type == OBJ_COMMIT);
+               /* always include all commit objects */
+               return LOFR_MARK_SEEN | LOFR_DO_SHOW;
+
        case LOFS_BEGIN_TREE:
                assert(obj->type == OBJ_TREE);
                dtype = DT_DIR;