@@ -932,6 +932,7 @@ struct has_commit_data {
932
932
struct repository * repo ;
933
933
int result ;
934
934
const char * path ;
935
+ const struct object_id * super_oid ;
935
936
};
936
937
937
938
static int check_has_commit (const struct object_id * oid , void * data )
@@ -940,7 +941,7 @@ static int check_has_commit(const struct object_id *oid, void *data)
940
941
struct repository subrepo ;
941
942
enum object_type type ;
942
943
943
- if (repo_submodule_init (& subrepo , cb -> repo , cb -> path , null_oid () )) {
944
+ if (repo_submodule_init (& subrepo , cb -> repo , cb -> path , cb -> super_oid )) {
944
945
cb -> result = 0 ;
945
946
goto cleanup ;
946
947
}
@@ -968,9 +969,15 @@ static int check_has_commit(const struct object_id *oid, void *data)
968
969
969
970
static int submodule_has_commits (struct repository * r ,
970
971
const char * path ,
972
+ const struct object_id * super_oid ,
971
973
struct oid_array * commits )
972
974
{
973
- struct has_commit_data has_commit = { r , 1 , path };
975
+ struct has_commit_data has_commit = {
976
+ .repo = r ,
977
+ .result = 1 ,
978
+ .path = path ,
979
+ .super_oid = super_oid
980
+ };
974
981
975
982
/*
976
983
* Perform a cheap, but incorrect check for the existence of 'commits'.
@@ -1017,7 +1024,7 @@ static int submodule_needs_pushing(struct repository *r,
1017
1024
const char * path ,
1018
1025
struct oid_array * commits )
1019
1026
{
1020
- if (!submodule_has_commits (r , path , commits ))
1027
+ if (!submodule_has_commits (r , path , null_oid (), commits ))
1021
1028
/*
1022
1029
* NOTE: We do consider it safe to return "no" here. The
1023
1030
* correct answer would be "We do not know" instead of
@@ -1277,7 +1284,7 @@ static void calculate_changed_submodule_paths(struct repository *r,
1277
1284
if (!path )
1278
1285
continue ;
1279
1286
1280
- if (submodule_has_commits (r , path , commits )) {
1287
+ if (submodule_has_commits (r , path , null_oid (), commits )) {
1281
1288
oid_array_clear (commits );
1282
1289
* name -> string = '\0' ;
1283
1290
}
@@ -1402,12 +1409,13 @@ static const struct submodule *get_non_gitmodules_submodule(const char *path)
1402
1409
}
1403
1410
1404
1411
static struct fetch_task * fetch_task_create (struct repository * r ,
1405
- const char * path )
1412
+ const char * path ,
1413
+ const struct object_id * treeish_name )
1406
1414
{
1407
1415
struct fetch_task * task = xmalloc (sizeof (* task ));
1408
1416
memset (task , 0 , sizeof (* task ));
1409
1417
1410
- task -> sub = submodule_from_path (r , null_oid () , path );
1418
+ task -> sub = submodule_from_path (r , treeish_name , path );
1411
1419
if (!task -> sub ) {
1412
1420
/*
1413
1421
* No entry in .gitmodules? Technically not a submodule,
@@ -1439,11 +1447,12 @@ static void fetch_task_release(struct fetch_task *p)
1439
1447
}
1440
1448
1441
1449
static struct repository * get_submodule_repo_for (struct repository * r ,
1442
- const char * path )
1450
+ const char * path ,
1451
+ const struct object_id * treeish_name )
1443
1452
{
1444
1453
struct repository * ret = xmalloc (sizeof (* ret ));
1445
1454
1446
- if (repo_submodule_init (ret , r , path , null_oid () )) {
1455
+ if (repo_submodule_init (ret , r , path , treeish_name )) {
1447
1456
free (ret );
1448
1457
return NULL ;
1449
1458
}
@@ -1464,7 +1473,7 @@ static int get_next_submodule(struct child_process *cp,
1464
1473
if (!S_ISGITLINK (ce -> ce_mode ))
1465
1474
continue ;
1466
1475
1467
- task = fetch_task_create (spf -> r , ce -> name );
1476
+ task = fetch_task_create (spf -> r , ce -> name , null_oid () );
1468
1477
if (!task )
1469
1478
continue ;
1470
1479
@@ -1487,7 +1496,7 @@ static int get_next_submodule(struct child_process *cp,
1487
1496
continue ;
1488
1497
}
1489
1498
1490
- task -> repo = get_submodule_repo_for (spf -> r , task -> sub -> path );
1499
+ task -> repo = get_submodule_repo_for (spf -> r , task -> sub -> path , null_oid () );
1491
1500
if (task -> repo ) {
1492
1501
struct strbuf submodule_prefix = STRBUF_INIT ;
1493
1502
child_process_init (cp );
0 commit comments