@@ -270,8 +270,8 @@ static int note_tree_insert(struct notes_tree *t, struct int_node *tree,
270270 if (!oidcmp (& l -> val_oid , & entry -> val_oid ))
271271 return 0 ;
272272
273- ret = combine_notes (l -> val_oid . hash ,
274- entry -> val_oid . hash );
273+ ret = combine_notes (& l -> val_oid ,
274+ & entry -> val_oid );
275275 if (!ret && is_null_oid (& l -> val_oid ))
276276 note_tree_remove (t , tree , n , entry );
277277 free (entry );
@@ -786,27 +786,27 @@ static int prune_notes_helper(const struct object_id *object_oid,
786786 return 0 ;
787787}
788788
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 )
791791{
792792 char * cur_msg = NULL , * new_msg = NULL , * buf ;
793793 unsigned long cur_len , new_len , buf_len ;
794794 enum object_type cur_type , new_type ;
795795 int ret ;
796796
797797 /* 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 );
800800 if (!new_msg || !new_len || new_type != OBJ_BLOB ) {
801801 free (new_msg );
802802 return 0 ;
803803 }
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 );
806806 if (!cur_msg || !cur_len || cur_type != OBJ_BLOB ) {
807807 free (cur_msg );
808808 free (new_msg );
809- hashcpy ( cur_sha1 , new_sha1 );
809+ oidcpy ( cur_oid , new_oid );
810810 return 0 ;
811811 }
812812
@@ -825,20 +825,20 @@ int combine_notes_concatenate(unsigned char *cur_sha1,
825825 free (new_msg );
826826
827827 /* 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 );
829829 free (buf );
830830 return ret ;
831831}
832832
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 )
835835{
836- hashcpy ( cur_sha1 , new_sha1 );
836+ oidcpy ( cur_oid , new_oid );
837837 return 0 ;
838838}
839839
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 )
842842{
843843 return 0 ;
844844}
@@ -848,17 +848,17 @@ int combine_notes_ignore(unsigned char *cur_sha1,
848848 * newlines removed.
849849 */
850850static int string_list_add_note_lines (struct string_list * list ,
851- const unsigned char * sha1 )
851+ const struct object_id * oid )
852852{
853853 char * data ;
854854 unsigned long len ;
855855 enum object_type t ;
856856
857- if (is_null_sha1 ( sha1 ))
857+ if (is_null_oid ( oid ))
858858 return 0 ;
859859
860860 /* read_sha1_file NUL-terminates */
861- data = read_sha1_file (sha1 , & t , & len );
861+ data = read_sha1_file (oid -> hash , & t , & len );
862862 if (t != OBJ_BLOB || !data || !len ) {
863863 free (data );
864864 return t != OBJ_BLOB || !data ;
@@ -884,17 +884,17 @@ static int string_list_join_lines_helper(struct string_list_item *item,
884884 return 0 ;
885885}
886886
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 )
889889{
890890 struct string_list sort_uniq_list = STRING_LIST_INIT_DUP ;
891891 struct strbuf buf = STRBUF_INIT ;
892892 int ret = 1 ;
893893
894894 /* 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 ))
896896 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 ))
898898 goto out ;
899899 string_list_remove_empty_items (& sort_uniq_list , 0 );
900900 string_list_sort (& sort_uniq_list );
@@ -905,7 +905,7 @@ int combine_notes_cat_sort_uniq(unsigned char *cur_sha1,
905905 string_list_join_lines_helper , & buf ))
906906 goto out ;
907907
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 );
909909
910910out :
911911 strbuf_release (& buf );
0 commit comments