@@ -725,7 +725,8 @@ int git_odb_exists_prefix(
725725 git_oid_cpy (out , short_id );
726726 return 0 ;
727727 } else {
728- return git_odb__error_notfound ("no match for id prefix" , short_id );
728+ return git_odb__error_notfound (
729+ "no match for id prefix" , short_id , len );
729730 }
730731 }
731732
@@ -740,7 +741,7 @@ int git_odb_exists_prefix(
740741 error = odb_exists_prefix_1 (out , db , & key , len , true);
741742
742743 if (error == GIT_ENOTFOUND )
743- return git_odb__error_notfound ("no match for id prefix" , & key );
744+ return git_odb__error_notfound ("no match for id prefix" , & key , len );
744745
745746 return error ;
746747}
@@ -881,7 +882,7 @@ int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id)
881882 error = odb_read_1 (out , db , id , true);
882883
883884 if (error == GIT_ENOTFOUND )
884- return git_odb__error_notfound ("no match for id" , id );
885+ return git_odb__error_notfound ("no match for id" , id , GIT_OID_HEXSZ );
885886
886887 return error ;
887888}
@@ -967,7 +968,7 @@ int git_odb_read_prefix(
967968 error = read_prefix_1 (out , db , & key , len , true);
968969
969970 if (error == GIT_ENOTFOUND )
970- return git_odb__error_notfound ("no match for prefix" , & key );
971+ return git_odb__error_notfound ("no match for prefix" , & key , len );
971972
972973 return error ;
973974}
@@ -1223,12 +1224,14 @@ int git_odb_refresh(struct git_odb *db)
12231224 return 0 ;
12241225}
12251226
1226- int git_odb__error_notfound (const char * message , const git_oid * oid )
1227+ int git_odb__error_notfound (
1228+ const char * message , const git_oid * oid , size_t oid_len )
12271229{
12281230 if (oid != NULL ) {
12291231 char oid_str [GIT_OID_HEXSZ + 1 ];
1230- git_oid_tostr (oid_str , sizeof (oid_str ), oid );
1231- giterr_set (GITERR_ODB , "Object not found - %s (%s)" , message , oid_str );
1232+ git_oid_tostr (oid_str , oid_len , oid );
1233+ giterr_set (GITERR_ODB , "Object not found - %s (%.*s)" ,
1234+ message , oid_len , oid_str );
12321235 } else
12331236 giterr_set (GITERR_ODB , "Object not found - %s" , message );
12341237
0 commit comments