| 1295 | } |
| 1296 | |
| 1297 | static void calculate_changed_submodule_paths(struct repository *r, |
| 1298 | struct string_list *changed_submodule_names) |
| 1299 | { |
| 1300 | struct strvec argv = STRVEC_INIT; |
| 1301 | struct string_list_item *name; |
| 1302 | |
| 1303 | /* No need to check if no submodules would be fetched */ |
| 1304 | if (!submodule_from_path(r, NULL, NULL) && |
| 1305 | !repo_has_absorbed_submodules(r)) |
| 1306 | return; |
| 1307 | |
| 1308 | strvec_push(&argv, "--"); /* argv[0] program name */ |
| 1309 | oid_array_for_each_unique(&ref_tips_after_fetch, |
| 1310 | append_oid_to_argv, &argv); |
| 1311 | strvec_push(&argv, "--not"); |
| 1312 | oid_array_for_each_unique(&ref_tips_before_fetch, |
| 1313 | append_oid_to_argv, &argv); |
| 1314 | |
| 1315 | /* |
| 1316 | * Collect all submodules (whether checked out or not) for which new |
| 1317 | * commits have been recorded upstream in "changed_submodule_names". |
| 1318 | */ |
| 1319 | collect_changed_submodules(r, changed_submodule_names, &argv); |
| 1320 | |
| 1321 | for_each_string_list_item(name, changed_submodule_names) { |
| 1322 | struct changed_submodule_data *cs_data = name->util; |
| 1323 | const struct submodule *submodule; |
| 1324 | const char *path = NULL; |
| 1325 | |
| 1326 | submodule = submodule_from_name(r, null_oid(the_hash_algo), name->string); |
| 1327 | if (submodule) |
| 1328 | path = submodule->path; |
| 1329 | else |
| 1330 | path = default_name_or_path(name->string); |
| 1331 | |
| 1332 | if (!path) |
| 1333 | continue; |
| 1334 | |
| 1335 | if (submodule_has_commits(r, path, null_oid(the_hash_algo), &cs_data->new_commits)) { |
| 1336 | changed_submodule_data_clear(cs_data); |
| 1337 | *name->string = '\0'; |
| 1338 | } |
| 1339 | } |
| 1340 | |
| 1341 | string_list_remove_empty_items(changed_submodule_names, 1); |
| 1342 | |
| 1343 | strvec_clear(&argv); |
| 1344 | oid_array_clear(&ref_tips_before_fetch); |
| 1345 | oid_array_clear(&ref_tips_after_fetch); |
| 1346 | initialized_fetch_ref_tips = 0; |
| 1347 | } |
| 1348 | |
| 1349 | int submodule_touches_in_range(struct repository *r, |
| 1350 | struct object_id *excl_oid, |
no test coverage detected