@@ -820,7 +820,7 @@ static int fsck_commit(struct commit *commit, const char *buffer,
820
820
return 0 ;
821
821
}
822
822
823
- static int fsck_tag (struct tag * tag , const char * buffer ,
823
+ static int fsck_tag (const struct object_id * oid , const char * buffer ,
824
824
unsigned long size , struct fsck_options * options )
825
825
{
826
826
struct object_id tagged_oid ;
@@ -829,48 +829,48 @@ static int fsck_tag(struct tag *tag, const char *buffer,
829
829
struct strbuf sb = STRBUF_INIT ;
830
830
const char * p ;
831
831
832
- ret = verify_headers (buffer , size , & tag -> object . oid , tag -> object . type , options );
832
+ ret = verify_headers (buffer , size , oid , OBJ_TAG , options );
833
833
if (ret )
834
834
goto done ;
835
835
836
836
if (!skip_prefix (buffer , "object " , & buffer )) {
837
- ret = report (options , & tag -> object . oid , tag -> object . type , FSCK_MSG_MISSING_OBJECT , "invalid format - expected 'object' line" );
837
+ ret = report (options , oid , OBJ_TAG , FSCK_MSG_MISSING_OBJECT , "invalid format - expected 'object' line" );
838
838
goto done ;
839
839
}
840
840
if (parse_oid_hex (buffer , & tagged_oid , & p ) || * p != '\n' ) {
841
- ret = report (options , & tag -> object . oid , tag -> object . type , FSCK_MSG_BAD_OBJECT_SHA1 , "invalid 'object' line format - bad sha1" );
841
+ ret = report (options , oid , OBJ_TAG , FSCK_MSG_BAD_OBJECT_SHA1 , "invalid 'object' line format - bad sha1" );
842
842
if (ret )
843
843
goto done ;
844
844
}
845
845
buffer = p + 1 ;
846
846
847
847
if (!skip_prefix (buffer , "type " , & buffer )) {
848
- ret = report (options , & tag -> object . oid , tag -> object . type , FSCK_MSG_MISSING_TYPE_ENTRY , "invalid format - expected 'type' line" );
848
+ ret = report (options , oid , OBJ_TAG , FSCK_MSG_MISSING_TYPE_ENTRY , "invalid format - expected 'type' line" );
849
849
goto done ;
850
850
}
851
851
eol = strchr (buffer , '\n' );
852
852
if (!eol ) {
853
- ret = report (options , & tag -> object . oid , tag -> object . type , FSCK_MSG_MISSING_TYPE , "invalid format - unexpected end after 'type' line" );
853
+ ret = report (options , oid , OBJ_TAG , FSCK_MSG_MISSING_TYPE , "invalid format - unexpected end after 'type' line" );
854
854
goto done ;
855
855
}
856
856
if (type_from_string_gently (buffer , eol - buffer , 1 ) < 0 )
857
- ret = report (options , & tag -> object . oid , tag -> object . type , FSCK_MSG_BAD_TYPE , "invalid 'type' value" );
857
+ ret = report (options , oid , OBJ_TAG , FSCK_MSG_BAD_TYPE , "invalid 'type' value" );
858
858
if (ret )
859
859
goto done ;
860
860
buffer = eol + 1 ;
861
861
862
862
if (!skip_prefix (buffer , "tag " , & buffer )) {
863
- ret = report (options , & tag -> object . oid , tag -> object . type , FSCK_MSG_MISSING_TAG_ENTRY , "invalid format - expected 'tag' line" );
863
+ ret = report (options , oid , OBJ_TAG , FSCK_MSG_MISSING_TAG_ENTRY , "invalid format - expected 'tag' line" );
864
864
goto done ;
865
865
}
866
866
eol = strchr (buffer , '\n' );
867
867
if (!eol ) {
868
- ret = report (options , & tag -> object . oid , tag -> object . type , FSCK_MSG_MISSING_TAG , "invalid format - unexpected end after 'type' line" );
868
+ ret = report (options , oid , OBJ_TAG , FSCK_MSG_MISSING_TAG , "invalid format - unexpected end after 'type' line" );
869
869
goto done ;
870
870
}
871
871
strbuf_addf (& sb , "refs/tags/%.*s" , (int )(eol - buffer ), buffer );
872
872
if (check_refname_format (sb .buf , 0 )) {
873
- ret = report (options , & tag -> object . oid , tag -> object . type ,
873
+ ret = report (options , oid , OBJ_TAG ,
874
874
FSCK_MSG_BAD_TAG_NAME ,
875
875
"invalid 'tag' name: %.*s" ,
876
876
(int )(eol - buffer ), buffer );
@@ -881,12 +881,12 @@ static int fsck_tag(struct tag *tag, const char *buffer,
881
881
882
882
if (!skip_prefix (buffer , "tagger " , & buffer )) {
883
883
/* early tags do not contain 'tagger' lines; warn only */
884
- ret = report (options , & tag -> object . oid , tag -> object . type , FSCK_MSG_MISSING_TAGGER_ENTRY , "invalid format - expected 'tagger' line" );
884
+ ret = report (options , oid , OBJ_TAG , FSCK_MSG_MISSING_TAGGER_ENTRY , "invalid format - expected 'tagger' line" );
885
885
if (ret )
886
886
goto done ;
887
887
}
888
888
else
889
- ret = fsck_ident (& buffer , & tag -> object . oid , tag -> object . type , options );
889
+ ret = fsck_ident (& buffer , oid , OBJ_TAG , options );
890
890
891
891
done :
892
892
strbuf_release (& sb );
@@ -987,8 +987,7 @@ int fsck_object(struct object *obj, void *data, unsigned long size,
987
987
return fsck_commit ((struct commit * ) obj , (const char * ) data ,
988
988
size , options );
989
989
if (obj -> type == OBJ_TAG )
990
- return fsck_tag ((struct tag * ) obj , (const char * ) data ,
991
- size , options );
990
+ return fsck_tag (& obj -> oid , data , size , options );
992
991
993
992
return report (options , & obj -> oid , obj -> type ,
994
993
FSCK_MSG_UNKNOWN_TYPE ,
0 commit comments