@@ -270,8 +270,8 @@ static int note_tree_insert(struct notes_tree *t, struct int_node *tree,
270
270
if (!oidcmp (& l -> val_oid , & entry -> val_oid ))
271
271
return 0 ;
272
272
273
- ret = combine_notes (l -> val_oid . hash ,
274
- entry -> val_oid . hash );
273
+ ret = combine_notes (& l -> val_oid ,
274
+ & entry -> val_oid );
275
275
if (!ret && is_null_oid (& l -> val_oid ))
276
276
note_tree_remove (t , tree , n , entry );
277
277
free (entry );
@@ -786,27 +786,27 @@ static int prune_notes_helper(const struct object_id *object_oid,
786
786
return 0 ;
787
787
}
788
788
789
- int combine_notes_concatenate (unsigned char * cur_sha1 ,
790
- const unsigned char * new_sha1 )
789
+ int combine_notes_concatenate (struct object_id * cur_oid ,
790
+ const struct object_id * new_oid )
791
791
{
792
792
char * cur_msg = NULL , * new_msg = NULL , * buf ;
793
793
unsigned long cur_len , new_len , buf_len ;
794
794
enum object_type cur_type , new_type ;
795
795
int ret ;
796
796
797
797
/* read in both note blob objects */
798
- if (!is_null_sha1 ( new_sha1 ))
799
- new_msg = read_sha1_file (new_sha1 , & new_type , & new_len );
798
+ if (!is_null_oid ( new_oid ))
799
+ new_msg = read_sha1_file (new_oid -> hash , & new_type , & new_len );
800
800
if (!new_msg || !new_len || new_type != OBJ_BLOB ) {
801
801
free (new_msg );
802
802
return 0 ;
803
803
}
804
- if (!is_null_sha1 ( cur_sha1 ))
805
- cur_msg = read_sha1_file (cur_sha1 , & cur_type , & cur_len );
804
+ if (!is_null_oid ( cur_oid ))
805
+ cur_msg = read_sha1_file (cur_oid -> hash , & cur_type , & cur_len );
806
806
if (!cur_msg || !cur_len || cur_type != OBJ_BLOB ) {
807
807
free (cur_msg );
808
808
free (new_msg );
809
- hashcpy ( cur_sha1 , new_sha1 );
809
+ oidcpy ( cur_oid , new_oid );
810
810
return 0 ;
811
811
}
812
812
@@ -825,20 +825,20 @@ int combine_notes_concatenate(unsigned char *cur_sha1,
825
825
free (new_msg );
826
826
827
827
/* create a new blob object from buf */
828
- ret = write_sha1_file (buf , buf_len , blob_type , cur_sha1 );
828
+ ret = write_sha1_file (buf , buf_len , blob_type , cur_oid -> hash );
829
829
free (buf );
830
830
return ret ;
831
831
}
832
832
833
- int combine_notes_overwrite (unsigned char * cur_sha1 ,
834
- const unsigned char * new_sha1 )
833
+ int combine_notes_overwrite (struct object_id * cur_oid ,
834
+ const struct object_id * new_oid )
835
835
{
836
- hashcpy ( cur_sha1 , new_sha1 );
836
+ oidcpy ( cur_oid , new_oid );
837
837
return 0 ;
838
838
}
839
839
840
- int combine_notes_ignore (unsigned char * cur_sha1 ,
841
- const unsigned char * new_sha1 )
840
+ int combine_notes_ignore (struct object_id * cur_oid ,
841
+ const struct object_id * new_oid )
842
842
{
843
843
return 0 ;
844
844
}
@@ -848,17 +848,17 @@ int combine_notes_ignore(unsigned char *cur_sha1,
848
848
* newlines removed.
849
849
*/
850
850
static int string_list_add_note_lines (struct string_list * list ,
851
- const unsigned char * sha1 )
851
+ const struct object_id * oid )
852
852
{
853
853
char * data ;
854
854
unsigned long len ;
855
855
enum object_type t ;
856
856
857
- if (is_null_sha1 ( sha1 ))
857
+ if (is_null_oid ( oid ))
858
858
return 0 ;
859
859
860
860
/* read_sha1_file NUL-terminates */
861
- data = read_sha1_file (sha1 , & t , & len );
861
+ data = read_sha1_file (oid -> hash , & t , & len );
862
862
if (t != OBJ_BLOB || !data || !len ) {
863
863
free (data );
864
864
return t != OBJ_BLOB || !data ;
@@ -884,17 +884,17 @@ static int string_list_join_lines_helper(struct string_list_item *item,
884
884
return 0 ;
885
885
}
886
886
887
- int combine_notes_cat_sort_uniq (unsigned char * cur_sha1 ,
888
- const unsigned char * new_sha1 )
887
+ int combine_notes_cat_sort_uniq (struct object_id * cur_oid ,
888
+ const struct object_id * new_oid )
889
889
{
890
890
struct string_list sort_uniq_list = STRING_LIST_INIT_DUP ;
891
891
struct strbuf buf = STRBUF_INIT ;
892
892
int ret = 1 ;
893
893
894
894
/* read both note blob objects into unique_lines */
895
- if (string_list_add_note_lines (& sort_uniq_list , cur_sha1 ))
895
+ if (string_list_add_note_lines (& sort_uniq_list , cur_oid ))
896
896
goto out ;
897
- if (string_list_add_note_lines (& sort_uniq_list , new_sha1 ))
897
+ if (string_list_add_note_lines (& sort_uniq_list , new_oid ))
898
898
goto out ;
899
899
string_list_remove_empty_items (& sort_uniq_list , 0 );
900
900
string_list_sort (& sort_uniq_list );
@@ -905,7 +905,7 @@ int combine_notes_cat_sort_uniq(unsigned char *cur_sha1,
905
905
string_list_join_lines_helper , & buf ))
906
906
goto out ;
907
907
908
- ret = write_sha1_file (buf .buf , buf .len , blob_type , cur_sha1 );
908
+ ret = write_sha1_file (buf .buf , buf .len , blob_type , cur_oid -> hash );
909
909
910
910
out :
911
911
strbuf_release (& buf );
0 commit comments