| 1080 | } |
| 1081 | |
| 1082 | int find_unpushed_submodules(struct repository *r, |
| 1083 | struct oid_array *commits, |
| 1084 | const char *remotes_name, |
| 1085 | struct string_list *needs_pushing) |
| 1086 | { |
| 1087 | struct string_list submodules = STRING_LIST_INIT_DUP; |
| 1088 | struct string_list_item *name; |
| 1089 | struct strvec argv = STRVEC_INIT; |
| 1090 | |
| 1091 | /* argv.v[0] will be ignored by setup_revisions */ |
| 1092 | strvec_push(&argv, "find_unpushed_submodules"); |
| 1093 | oid_array_for_each_unique(commits, append_oid_to_argv, &argv); |
| 1094 | strvec_push(&argv, "--not"); |
| 1095 | strvec_pushf(&argv, "--remotes=%s", remotes_name); |
| 1096 | |
| 1097 | collect_changed_submodules(r, &submodules, &argv); |
| 1098 | |
| 1099 | for_each_string_list_item(name, &submodules) { |
| 1100 | struct changed_submodule_data *cs_data = name->util; |
| 1101 | const struct submodule *submodule; |
| 1102 | const char *path = NULL; |
| 1103 | |
| 1104 | submodule = submodule_from_name(r, null_oid(the_hash_algo), name->string); |
| 1105 | if (submodule) |
| 1106 | path = submodule->path; |
| 1107 | else |
| 1108 | path = default_name_or_path(name->string); |
| 1109 | |
| 1110 | if (!path) |
| 1111 | continue; |
| 1112 | |
| 1113 | if (submodule_needs_pushing(r, path, &cs_data->new_commits)) |
| 1114 | string_list_insert(needs_pushing, path); |
| 1115 | } |
| 1116 | |
| 1117 | free_submodules_data(&submodules); |
| 1118 | strvec_clear(&argv); |
| 1119 | |
| 1120 | return needs_pushing->nr; |
| 1121 | } |
| 1122 | |
| 1123 | static int push_submodule(const char *path, |
| 1124 | const struct remote *remote, |
no test coverage detected