@@ -138,7 +138,7 @@ static int commit_graph_parse_oid_lookup(
138138 struct git_commit_graph_chunk * chunk_oid_lookup )
139139{
140140 uint32_t i ;
141- git_oid * oid , * prev_oid , zero_oid = {{ 0 } };
141+ unsigned char * oid , * prev_oid , zero_oid [ GIT_OID_RAWSZ ] = {0 };
142142
143143 if (chunk_oid_lookup -> offset == 0 )
144144 return commit_graph_error ("missing OID Lookup chunk" );
@@ -147,10 +147,10 @@ static int commit_graph_parse_oid_lookup(
147147 if (chunk_oid_lookup -> length != file -> num_commits * GIT_OID_RAWSZ )
148148 return commit_graph_error ("OID Lookup chunk has wrong length" );
149149
150- file -> oid_lookup = oid = (git_oid * )(data + chunk_oid_lookup -> offset );
151- prev_oid = & zero_oid ;
152- for (i = 0 ; i < file -> num_commits ; ++ i , ++ oid ) {
153- if (git_oid_cmp (prev_oid , oid ) >= 0 )
150+ file -> oid_lookup = oid = (unsigned char * )(data + chunk_oid_lookup -> offset );
151+ prev_oid = zero_oid ;
152+ for (i = 0 ; i < file -> num_commits ; ++ i , oid += GIT_OID_RAWSZ ) {
153+ if (git_oid_raw_cmp (prev_oid , oid ) >= 0 )
154154 return commit_graph_error ("OID Lookup index is non-monotonic" );
155155 prev_oid = oid ;
156156 }
@@ -437,7 +437,7 @@ static int git_commit_graph_entry_get_byindex(
437437 }
438438
439439 commit_data = file -> commit_data + pos * (GIT_OID_RAWSZ + 4 * sizeof (uint32_t ));
440- git_oid_cpy (& e -> tree_oid , ( const git_oid * ) commit_data );
440+ git_oid_fromraw (& e -> tree_oid , commit_data );
441441 e -> parent_indices [0 ] = ntohl (* ((uint32_t * )(commit_data + GIT_OID_RAWSZ )));
442442 e -> parent_indices [1 ] = ntohl (
443443 * ((uint32_t * )(commit_data + GIT_OID_RAWSZ + sizeof (uint32_t ))));
@@ -470,7 +470,8 @@ static int git_commit_graph_entry_get_byindex(
470470 e -> parent_count ++ ;
471471 }
472472 }
473- git_oid_cpy (& e -> sha1 , & file -> oid_lookup [pos ]);
473+
474+ git_oid_fromraw (& e -> sha1 , & file -> oid_lookup [pos * GIT_OID_RAWSZ ]);
474475 return 0 ;
475476}
476477
@@ -514,7 +515,7 @@ int git_commit_graph_entry_find(
514515{
515516 int pos , found = 0 ;
516517 uint32_t hi , lo ;
517- const git_oid * current = NULL ;
518+ const unsigned char * current = NULL ;
518519
519520 GIT_ASSERT_ARG (e );
520521 GIT_ASSERT_ARG (file );
@@ -528,26 +529,25 @@ int git_commit_graph_entry_find(
528529 if (pos >= 0 ) {
529530 /* An object matching exactly the oid was found */
530531 found = 1 ;
531- current = file -> oid_lookup + pos ;
532+ current = file -> oid_lookup + ( pos * GIT_OID_RAWSZ ) ;
532533 } else {
533534 /* No object was found */
534535 /* pos refers to the object with the "closest" oid to short_oid */
535536 pos = -1 - pos ;
536537 if (pos < (int )file -> num_commits ) {
537- current = file -> oid_lookup + pos ;
538+ current = file -> oid_lookup + ( pos * GIT_OID_RAWSZ ) ;
538539
539- if (!git_oid_ncmp (short_oid , current , len ))
540+ if (!git_oid_raw_ncmp (short_oid -> id , current , len ))
540541 found = 1 ;
541542 }
542543 }
543544
544545 if (found && len != GIT_OID_HEXSZ && pos + 1 < (int )file -> num_commits ) {
545546 /* Check for ambiguousity */
546- const git_oid * next = current + 1 ;
547+ const unsigned char * next = current + GIT_OID_RAWSZ ;
547548
548- if (!git_oid_ncmp (short_oid , next , len )) {
549+ if (!git_oid_raw_ncmp (short_oid -> id , next , len ))
549550 found = 2 ;
550- }
551551 }
552552
553553 if (!found )
@@ -1019,7 +1019,9 @@ static int commit_graph_write(
10191019 /* Fill the OID Lookup table. */
10201020 git_vector_foreach (& w -> commits , i , packed_commit ) {
10211021 error = git_str_put (& oid_lookup ,
1022- (const char * )& packed_commit -> sha1 , sizeof (git_oid ));
1022+ (const char * )& packed_commit -> sha1 .id ,
1023+ GIT_OID_RAWSZ );
1024+
10231025 if (error < 0 )
10241026 goto cleanup ;
10251027 }
@@ -1034,8 +1036,9 @@ static int commit_graph_write(
10341036 unsigned int parentcount = (unsigned int )git_array_size (packed_commit -> parents );
10351037
10361038 error = git_str_put (& commit_data ,
1037- (const char * )& packed_commit -> tree_oid ,
1038- sizeof (git_oid ));
1039+ (const char * )& packed_commit -> tree_oid .id ,
1040+ GIT_OID_RAWSZ );
1041+
10391042 if (error < 0 )
10401043 goto cleanup ;
10411044
0 commit comments