@@ -223,8 +223,8 @@ struct patch {
223
223
struct fragment * fragments ;
224
224
char * result ;
225
225
size_t resultsize ;
226
- char old_sha1_prefix [GIT_MAX_HEXSZ + 1 ];
227
- char new_sha1_prefix [GIT_MAX_HEXSZ + 1 ];
226
+ char old_oid_prefix [GIT_MAX_HEXSZ + 1 ];
227
+ char new_oid_prefix [GIT_MAX_HEXSZ + 1 ];
228
228
struct patch * next ;
229
229
230
230
/* three-way fallback result */
@@ -1099,8 +1099,8 @@ static int gitdiff_index(struct apply_state *state,
1099
1099
if (!ptr || ptr [1 ] != '.' || hexsz < ptr - line )
1100
1100
return 0 ;
1101
1101
len = ptr - line ;
1102
- memcpy (patch -> old_sha1_prefix , line , len );
1103
- patch -> old_sha1_prefix [len ] = 0 ;
1102
+ memcpy (patch -> old_oid_prefix , line , len );
1103
+ patch -> old_oid_prefix [len ] = 0 ;
1104
1104
1105
1105
line = ptr + 2 ;
1106
1106
ptr = strchr (line , ' ' );
@@ -1112,8 +1112,8 @@ static int gitdiff_index(struct apply_state *state,
1112
1112
1113
1113
if (hexsz < len )
1114
1114
return 0 ;
1115
- memcpy (patch -> new_sha1_prefix , line , len );
1116
- patch -> new_sha1_prefix [len ] = 0 ;
1115
+ memcpy (patch -> new_oid_prefix , line , len );
1116
+ patch -> new_oid_prefix [len ] = 0 ;
1117
1117
if (* ptr == ' ' )
1118
1118
return gitdiff_oldmode (state , ptr + 1 , patch );
1119
1119
return 0 ;
@@ -2205,7 +2205,7 @@ static void reverse_patches(struct patch *p)
2205
2205
SWAP (p -> new_mode , p -> old_mode );
2206
2206
SWAP (p -> is_new , p -> is_delete );
2207
2207
SWAP (p -> lines_added , p -> lines_deleted );
2208
- SWAP (p -> old_sha1_prefix , p -> new_sha1_prefix );
2208
+ SWAP (p -> old_oid_prefix , p -> new_oid_prefix );
2209
2209
2210
2210
for (; frag ; frag = frag -> next ) {
2211
2211
SWAP (frag -> newpos , frag -> oldpos );
@@ -3149,10 +3149,10 @@ static int apply_binary(struct apply_state *state,
3149
3149
* For safety, we require patch index line to contain
3150
3150
* full hex textual object ID for old and new, at least for now.
3151
3151
*/
3152
- if (strlen (patch -> old_sha1_prefix ) != hexsz ||
3153
- strlen (patch -> new_sha1_prefix ) != hexsz ||
3154
- get_oid_hex (patch -> old_sha1_prefix , & oid ) ||
3155
- get_oid_hex (patch -> new_sha1_prefix , & oid ))
3152
+ if (strlen (patch -> old_oid_prefix ) != hexsz ||
3153
+ strlen (patch -> new_oid_prefix ) != hexsz ||
3154
+ get_oid_hex (patch -> old_oid_prefix , & oid ) ||
3155
+ get_oid_hex (patch -> new_oid_prefix , & oid ))
3156
3156
return error (_ ("cannot apply binary patch to '%s' "
3157
3157
"without full index line" ), name );
3158
3158
@@ -3162,7 +3162,7 @@ static int apply_binary(struct apply_state *state,
3162
3162
* applies to.
3163
3163
*/
3164
3164
hash_object_file (img -> buf , img -> len , blob_type , & oid );
3165
- if (strcmp (oid_to_hex (& oid ), patch -> old_sha1_prefix ))
3165
+ if (strcmp (oid_to_hex (& oid ), patch -> old_oid_prefix ))
3166
3166
return error (_ ("the patch applies to '%s' (%s), "
3167
3167
"which does not match the "
3168
3168
"current contents." ),
@@ -3175,7 +3175,7 @@ static int apply_binary(struct apply_state *state,
3175
3175
"'%s' but it is not empty" ), name );
3176
3176
}
3177
3177
3178
- get_oid_hex (patch -> new_sha1_prefix , & oid );
3178
+ get_oid_hex (patch -> new_oid_prefix , & oid );
3179
3179
if (is_null_oid (& oid )) {
3180
3180
clear_image (img );
3181
3181
return 0 ; /* deletion patch */
@@ -3191,7 +3191,7 @@ static int apply_binary(struct apply_state *state,
3191
3191
if (!result )
3192
3192
return error (_ ("the necessary postimage %s for "
3193
3193
"'%s' cannot be read" ),
3194
- patch -> new_sha1_prefix , name );
3194
+ patch -> new_oid_prefix , name );
3195
3195
clear_image (img );
3196
3196
img -> buf = result ;
3197
3197
img -> len = size ;
@@ -3207,9 +3207,9 @@ static int apply_binary(struct apply_state *state,
3207
3207
3208
3208
/* verify that the result matches */
3209
3209
hash_object_file (img -> buf , img -> len , blob_type , & oid );
3210
- if (strcmp (oid_to_hex (& oid ), patch -> new_sha1_prefix ))
3210
+ if (strcmp (oid_to_hex (& oid ), patch -> new_oid_prefix ))
3211
3211
return error (_ ("binary patch to '%s' creates incorrect result (expecting %s, got %s)" ),
3212
- name , patch -> new_sha1_prefix , oid_to_hex (& oid ));
3212
+ name , patch -> new_oid_prefix , oid_to_hex (& oid ));
3213
3213
}
3214
3214
3215
3215
return 0 ;
@@ -3565,7 +3565,7 @@ static int try_threeway(struct apply_state *state,
3565
3565
/* Preimage the patch was prepared for */
3566
3566
if (patch -> is_new )
3567
3567
write_object_file ("" , 0 , blob_type , & pre_oid );
3568
- else if (get_oid (patch -> old_sha1_prefix , & pre_oid ) ||
3568
+ else if (get_oid (patch -> old_oid_prefix , & pre_oid ) ||
3569
3569
read_blob_object (& buf , & pre_oid , patch -> old_mode ))
3570
3570
return error (_ ("repository lacks the necessary blob to fall back on 3-way merge." ));
3571
3571
@@ -4059,11 +4059,11 @@ static int preimage_oid_in_gitlink_patch(struct patch *p, struct object_id *oid)
4059
4059
!get_oid_hex (preimage + sizeof (heading ) - 1 , oid ) &&
4060
4060
preimage [sizeof (heading ) + the_hash_algo -> hexsz - 1 ] == '\n' &&
4061
4061
/* does the abbreviated name on the index line agree with it? */
4062
- starts_with (preimage + sizeof (heading ) - 1 , p -> old_sha1_prefix ))
4062
+ starts_with (preimage + sizeof (heading ) - 1 , p -> old_oid_prefix ))
4063
4063
return 0 ; /* it all looks fine */
4064
4064
4065
4065
/* we may have full object name on the index line */
4066
- return get_oid_hex (p -> old_sha1_prefix , oid );
4066
+ return get_oid_hex (p -> old_oid_prefix , oid );
4067
4067
}
4068
4068
4069
4069
/* Build an index that contains just the files needed for a 3way merge */
@@ -4092,7 +4092,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
4092
4092
else
4093
4093
return error (_ ("sha1 information is lacking or "
4094
4094
"useless for submodule %s" ), name );
4095
- } else if (!get_oid_blob (patch -> old_sha1_prefix , & oid )) {
4095
+ } else if (!get_oid_blob (patch -> old_oid_prefix , & oid )) {
4096
4096
; /* ok */
4097
4097
} else if (!patch -> lines_added && !patch -> lines_deleted ) {
4098
4098
/* mode-only change: update the current */
0 commit comments