2243
*/
2244
if (!is_tip_reachable(ud->sm_path, &ud->oid) &&
2245
fetch_in_submodule(ud->sm_path, ud->depth, ud->quiet, &ud->oid))
2246
- die(_("Fetched in submodule path '%s', but it did not "
2247
- "contain %s. Direct fetching of that commit failed."),
2248
- ud->displaypath, oid_to_hex(&ud->oid));
2246
+ return die_message(_("Fetched in submodule path '%s', but it did not "
2247
+ "contain %s. Direct fetching of that commit failed."),
2248
+ ud->displaypath, oid_to_hex(&ud->oid));
2249
}
2250
2251
return run_update_command(ud, subforce);
2289
return branch;
2290
}
2291
2292
-static void ensure_core_worktree(const char *path)
2292
+static int ensure_core_worktree(const char *path)
2293
{
2294
const char *cw;
2295
struct repository subrepo;
2296
2297
if (repo_submodule_init(&subrepo, the_repository, path, null_oid()))
2298
- die(_("could not get a repository handle for submodule '%s'"), path);
2298
+ return die_message(_("could not get a repository handle for submodule '%s'"),
2299
+ path);
2300
2301
if (!repo_config_get_string_tmp(&subrepo, "core.worktree", &cw)) {
2302
char *cfg_file, *abs_path;
2314
free(abs_path);
2315
strbuf_release(&sb);
2316
}
2317
+
2318
+ return 0;
2319
}
2320
2321
static const char *submodule_update_type_to_label(enum submodule_update_type type)
2392
{
2393
int ret;
2394
2392
- ensure_core_worktree(update_data->sm_path);
2395
+ ret = ensure_core_worktree(update_data->sm_path);
2396
+ if (ret)
2397
+ return ret;
2398
2399
update_data->displaypath = get_submodule_displaypath(
2400
update_data->sm_path, update_data->prefix);
2410
if (update_data->just_cloned)
2411
oidcpy(&update_data->suboid, null_oid());
2412
else if (resolve_gitlink_ref(update_data->sm_path, "HEAD", &update_data->suboid))
2408
- die(_("Unable to find current revision in submodule path '%s'"),
2409
- update_data->displaypath);
2413
+ return die_message(_("Unable to find current revision in submodule path '%s'"),
2414
+ update_data->displaypath);
2415
2416
if (update_data->remote) {
2417
char *remote_name = get_default_remote_submodule(update_data->sm_path);
2421
if (!update_data->nofetch) {
2422
if (fetch_in_submodule(update_data->sm_path, update_data->depth,
2423
0, NULL))
2419
- die(_("Unable to fetch in submodule path '%s'"),
2420
- update_data->sm_path);
2424
+ return die_message(_("Unable to fetch in submodule path '%s'"),
2425
+ update_data->sm_path);
2426
}
2427
2428
if (resolve_gitlink_ref(update_data->sm_path, remote_ref, &update_data->oid))
2424
- die(_("Unable to find %s revision in submodule path '%s'"),
2425
- remote_ref, update_data->sm_path);
2429
+ return die_message(_("Unable to find %s revision in submodule path '%s'"),
2430
+ remote_ref, update_data->sm_path);
2431
2432
free(remote_ref);
2433
}