477
478
struct init_cb {
479
const char *prefix;
480
- const char *superprefix;
480
unsigned int flags;
481
};
482
#define INIT_CB_INIT { 0 }
483
484
static void init_submodule(const char *path, const char *prefix,
486
- const char *superprefix, unsigned int flags)
485
+ unsigned int flags)
486
{
487
const struct submodule *sub;
488
struct strbuf sb = STRBUF_INIT;
489
char *upd = NULL, *url = NULL, *displaypath;
490
492
- /* try superprefix from the environment, if it is not passed explicitly */
493
- if (!superprefix)
494
- superprefix = get_super_prefix();
495
- displaypath = do_get_submodule_displaypath(path, prefix, superprefix);
491
+ displaypath = do_get_submodule_displaypath(path, prefix, get_super_prefix());
492
493
sub = submodule_from_path(the_repository, null_oid(), path);
494
562
static void init_submodule_cb(const struct cache_entry *list_item, void *cb_data)
563
{
564
struct init_cb *info = cb_data;
569
- init_submodule(list_item->name, info->prefix, info->superprefix, info->flags);
565
+ init_submodule(list_item->name, info->prefix, info->flags);
566
}
567
568
static int module_init(int argc, const char **argv, const char *prefix)
1874
1875
struct update_data {
1876
const char *prefix;
1881
- const char *recursive_prefix;
1877
const char *displaypath;
1878
enum submodule_update_type update_default;
1879
struct object_id suboid;
1944
char *key;
1945
struct update_data *ud = suc->update_data;
1946
char *displaypath = do_get_submodule_displaypath(ce->name, ud->prefix,
1952
- ud->recursive_prefix);
1947
+ get_super_prefix());
1948
struct strbuf sb = STRBUF_INIT;
1949
int needs_cloning = 0;
1950
int need_free_url = 0;
2410
{
2411
enum submodule_update_type update_type = update_data->update_default;
2412
2418
- strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL);
2419
- strvec_pushf(args, "--jobs=%d", update_data->max_jobs);
2413
if (update_data->displaypath) {
2421
- strvec_push(args, "--recursive-prefix");
2414
+ strvec_push(args, "--super-prefix");
2415
strvec_pushf(args, "%s/", update_data->displaypath);
2416
}
2417
+ strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL);
2418
+ strvec_pushf(args, "--jobs=%d", update_data->max_jobs);
2419
if (update_data->quiet)
2420
strvec_push(args, "--quiet");
2421
if (update_data->force)
2463
2464
update_data->displaypath = do_get_submodule_displaypath(update_data->sm_path,
2465
update_data->prefix,
2471
- update_data->recursive_prefix);
2466
+ get_super_prefix());
2467
2468
determine_submodule_update_strategy(the_repository, update_data->just_cloned,
2469
update_data->sm_path, update_data->update_default,
2587
OPT_STRING(0, "prefix", &opt.prefix,
2588
N_("path"),
2589
N_("path into the working tree")),
2595
- OPT_STRING(0, "recursive-prefix", &opt.recursive_prefix,
2596
- N_("path"),
2597
- N_("path into the working tree, across nested "
2598
- "submodule boundaries")),
2590
OPT_SET_INT(0, "checkout", &opt.update_default,
2591
N_("use the 'checkout' update strategy (default)"),
2592
SM_UPDATE_CHECKOUT),
2672
module_list_active(&list);
2673
2674
info.prefix = opt.prefix;
2684
- info.superprefix = opt.recursive_prefix;
2675
if (opt.quiet)
2676
info.flags |= OPT_QUIET;
2677
3368
static struct cmd_struct commands[] = {
3369
{"list", module_list, 0},
3370
{"name", module_name, 0},
3381
- {"clone", module_clone, 0},
3371
+ {"clone", module_clone, SUPPORT_SUPER_PREFIX},
3372
{"add", module_add, 0},
3383
- {"update", module_update, 0},
3373
+ {"update", module_update, SUPPORT_SUPER_PREFIX},
3374
{"resolve-relative-url-test", resolve_relative_url_test, 0},
3375
{"foreach", module_foreach, SUPPORT_SUPER_PREFIX},
3376
{"init", module_init, 0},