* Perform a check in the submodule to see if the remote and refspec work. * Die if the submodule can't be pushed. */
| 1172 | * Die if the submodule can't be pushed. |
| 1173 | */ |
| 1174 | static void submodule_push_check(const char *path, const char *head, |
| 1175 | const struct remote *remote, |
| 1176 | const struct refspec *rs) |
| 1177 | { |
| 1178 | struct child_process cp = CHILD_PROCESS_INIT; |
| 1179 | int i; |
| 1180 | |
| 1181 | if (validate_submodule_path(path) < 0) |
| 1182 | exit(128); |
| 1183 | |
| 1184 | strvec_push(&cp.args, "submodule--helper"); |
| 1185 | strvec_push(&cp.args, "push-check"); |
| 1186 | strvec_push(&cp.args, head); |
| 1187 | strvec_push(&cp.args, remote->name); |
| 1188 | |
| 1189 | for (i = 0; i < rs->nr; i++) |
| 1190 | strvec_push(&cp.args, rs->items[i].raw); |
| 1191 | |
| 1192 | prepare_submodule_repo_env(&cp.env); |
| 1193 | cp.git_cmd = 1; |
| 1194 | cp.no_stdin = 1; |
| 1195 | cp.no_stdout = 1; |
| 1196 | cp.dir = path; |
| 1197 | |
| 1198 | /* |
| 1199 | * Simply indicate if 'submodule--helper push-check' failed. |
| 1200 | * More detailed error information will be provided by the |
| 1201 | * child process. |
| 1202 | */ |
| 1203 | if (run_command(&cp)) |
| 1204 | die(_("process for submodule '%s' failed"), path); |
| 1205 | } |
| 1206 | |
| 1207 | int push_unpushed_submodules(struct repository *r, |
| 1208 | struct oid_array *commits, |
no test coverage detected