@@ -136,13 +136,30 @@ GIT_INLINE(void) clar__assert_equal_oid(
136136 const char * file , const char * func , int line , const char * desc ,
137137 const git_oid * one , const git_oid * two )
138138{
139- if (git_oid_cmp (one , two )) {
140- char err [] = "\"........................................\" != \"........................................\"" ;
141139
140+ if (git_oid_equal (one , two ))
141+ return ;
142+
143+ if (one -> type != two -> type ) {
144+ char err [64 ];
145+
146+ snprintf (err , 64 , "different oid types: %d vs %d" , one -> type , two -> type );
147+ clar__fail (file , func , line , desc , err , 1 );
148+ } else if (one -> type == GIT_OID_SHA1 ) {
149+ char err [] = "\"........................................\" != \"........................................\"" ;
142150 git_oid_fmt (& err [1 ], one );
143151 git_oid_fmt (& err [47 ], two );
144152
145153 clar__fail (file , func , line , desc , err , 1 );
154+ } else if (one -> type == GIT_OID_SHA256 ) {
155+ char err [] = "\"................................................................\" != \"................................................................\"" ;
156+
157+ git_oid_fmt (& err [1 ], one );
158+ git_oid_fmt (& err [71 ], one );
159+
160+ clar__fail (file , func , line , desc , err , 1 );
161+ } else {
162+ clar__fail (file , func , line , desc , "unknown oid types" , 1 );
146163 }
147164}
148165
0 commit comments