@@ -1279,26 +1279,6 @@ int match_push_refs(struct ref *src, struct ref **dst,
1279
1279
return 0 ;
1280
1280
}
1281
1281
1282
- static inline int is_forwardable (struct ref * ref )
1283
- {
1284
- struct object * o ;
1285
-
1286
- if (!prefixcmp (ref -> name , "refs/tags/" ))
1287
- return 0 ;
1288
-
1289
- /* old object must be a commit */
1290
- o = parse_object (ref -> old_sha1 );
1291
- if (!o || o -> type != OBJ_COMMIT )
1292
- return 0 ;
1293
-
1294
- /* new object must be commit-ish */
1295
- o = deref_tag (parse_object (ref -> new_sha1 ), NULL , 0 );
1296
- if (!o || o -> type != OBJ_COMMIT )
1297
- return 0 ;
1298
-
1299
- return 1 ;
1300
- }
1301
-
1302
1282
void set_ref_status_for_push (struct ref * remote_refs , int send_mirror ,
1303
1283
int force_update )
1304
1284
{
@@ -1320,32 +1300,23 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
1320
1300
}
1321
1301
1322
1302
/*
1323
- * The below logic determines whether an individual
1324
- * refspec A:B can be pushed. The push will succeed
1325
- * if any of the following are true:
1303
+ * Decide whether an individual refspec A:B can be
1304
+ * pushed. The push will succeed if any of the
1305
+ * following are true:
1326
1306
*
1327
1307
* (1) the remote reference B does not exist
1328
1308
*
1329
1309
* (2) the remote reference B is being removed (i.e.,
1330
1310
* pushing :B where no source is specified)
1331
1311
*
1332
- * (3) the update meets all fast-forwarding criteria:
1333
- *
1334
- * (a) the destination is not under refs/tags/
1335
- * (b) the old is a commit
1336
- * (c) the new is a descendant of the old
1337
- *
1338
- * NOTE: We must actually have the old object in
1339
- * order to overwrite it in the remote reference,
1340
- * and the new object must be commit-ish. These are
1341
- * implied by (b) and (c) respectively.
1312
+ * (3) the destination is not under refs/tags/, and
1313
+ * if the old and new value is a commit, the new
1314
+ * is a descendant of the old.
1342
1315
*
1343
1316
* (4) it is forced using the +A:B notation, or by
1344
1317
* passing the --force argument
1345
1318
*/
1346
1319
1347
- ref -> not_forwardable = !is_forwardable (ref );
1348
-
1349
1320
ref -> update =
1350
1321
!ref -> deletion &&
1351
1322
!is_null_sha1 (ref -> old_sha1 );
@@ -1355,7 +1326,7 @@ void set_ref_status_for_push(struct ref *remote_refs, int send_mirror,
1355
1326
!has_sha1_file (ref -> old_sha1 )
1356
1327
|| !ref_newer (ref -> new_sha1 , ref -> old_sha1 );
1357
1328
1358
- if (ref -> not_forwardable ) {
1329
+ if (! prefixcmp ( ref -> name , "refs/tags/" ) ) {
1359
1330
ref -> requires_force = 1 ;
1360
1331
if (!force_ref_update ) {
1361
1332
ref -> status = REF_STATUS_REJECT_ALREADY_EXISTS ;
0 commit comments