MCPcopy Index your code
hub / github.com/git/git / push_unpushed_submodules

Function push_unpushed_submodules

submodule.c:1207–1256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1205}
1206
1207int push_unpushed_submodules(struct repository *r,
1208 struct oid_array *commits,
1209 const struct remote *remote,
1210 const struct refspec *rs,
1211 const struct string_list *push_options,
1212 int dry_run)
1213{
1214 int i, ret = 1;
1215 struct string_list needs_pushing = STRING_LIST_INIT_DUP;
1216
1217 if (!find_unpushed_submodules(r, commits,
1218 remote->name, &needs_pushing))
1219 return 1;
1220
1221 /*
1222 * Verify that the remote and refspec can be propagated to all
1223 * submodules. This check can be skipped if the remote and refspec
1224 * won't be propagated due to the remote being unconfigured (e.g. a URL
1225 * instead of a remote name).
1226 */
1227 if (remote->origin != REMOTE_UNCONFIGURED) {
1228 char *head;
1229 struct object_id head_oid;
1230
1231 head = refs_resolve_refdup(get_main_ref_store(the_repository),
1232 "HEAD", 0, &head_oid, NULL);
1233 if (!head)
1234 die(_("Failed to resolve HEAD as a valid ref."));
1235
1236 for (i = 0; i < needs_pushing.nr; i++)
1237 submodule_push_check(needs_pushing.items[i].string,
1238 head, remote, rs);
1239 free(head);
1240 }
1241
1242 /* Actually push the submodules */
1243 for (i = 0; i < needs_pushing.nr; i++) {
1244 const char *path = needs_pushing.items[i].string;
1245 fprintf(stderr, _("Pushing submodule '%s'\n"), path);
1246 if (!push_submodule(path, remote, rs,
1247 push_options, dry_run)) {
1248 fprintf(stderr, _("Unable to push submodule '%s'\n"), path);
1249 ret = 0;
1250 }
1251 }
1252
1253 string_list_clear(&needs_pushing, 0);
1254
1255 return ret;
1256}
1257
1258static int append_oid_to_array(const struct reference *ref, void *data)
1259{

Callers 1

transport_pushFunction · 0.85

Calls 7

find_unpushed_submodulesFunction · 0.85
refs_resolve_refdupFunction · 0.85
get_main_ref_storeFunction · 0.85
submodule_push_checkFunction · 0.85
push_submoduleFunction · 0.85
string_list_clearFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected