@@ -573,6 +573,7 @@ static int module_init(int argc, const char **argv, const char *prefix)
573
573
574
574
struct status_cb {
575
575
const char * prefix ;
576
+ const char * super_prefix ;
576
577
unsigned int flags ;
577
578
};
578
579
#define STATUS_CB_INIT { 0 }
@@ -611,7 +612,7 @@ static int handle_submodule_head_ref(const char *refname UNUSED,
611
612
612
613
static void status_submodule (const char * path , const struct object_id * ce_oid ,
613
614
unsigned int ce_flags , const char * prefix ,
614
- unsigned int flags )
615
+ const char * super_prefix , unsigned int flags )
615
616
{
616
617
char * displaypath ;
617
618
struct strvec diff_files_args = STRVEC_INIT ;
@@ -627,8 +628,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
627
628
die (_ ("no submodule mapping found in .gitmodules for path '%s'" ),
628
629
path );
629
630
630
- displaypath = get_submodule_displaypath (path , prefix ,
631
- get_super_prefix ());
631
+ displaypath = get_submodule_displaypath (path , prefix , super_prefix );
632
632
633
633
if ((CE_STAGEMASK & ce_flags ) >> CE_STAGESHIFT ) {
634
634
print_status (flags , 'U' , path , null_oid (), displaypath );
@@ -686,10 +686,10 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
686
686
cpr .dir = path ;
687
687
prepare_submodule_repo_env (& cpr .env );
688
688
689
- strvec_push (& cpr .args , "--super-prefix" );
690
- strvec_pushf (& cpr .args , "%s/" , displaypath );
691
689
strvec_pushl (& cpr .args , "submodule--helper" , "status" ,
692
690
"--recursive" , NULL );
691
+ strvec_push (& cpr .args , "--super-prefix" );
692
+ strvec_pushf (& cpr .args , "%s/" , displaypath );
693
693
694
694
if (flags & OPT_CACHED )
695
695
strvec_push (& cpr .args , "--cached" );
@@ -713,7 +713,7 @@ static void status_submodule_cb(const struct cache_entry *list_item,
713
713
struct status_cb * info = cb_data ;
714
714
715
715
status_submodule (list_item -> name , & list_item -> oid , list_item -> ce_flags ,
716
- info -> prefix , info -> flags );
716
+ info -> prefix , info -> super_prefix , info -> flags );
717
717
}
718
718
719
719
static int module_status (int argc , const char * * argv , const char * prefix )
@@ -723,6 +723,7 @@ static int module_status(int argc, const char **argv, const char *prefix)
723
723
struct module_list list = MODULE_LIST_INIT ;
724
724
int quiet = 0 ;
725
725
struct option module_status_options [] = {
726
+ OPT__SUPER_PREFIX (& info .super_prefix ),
726
727
OPT__QUIET (& quiet , N_ ("suppress submodule status output" )),
727
728
OPT_BIT (0 , "cached" , & info .flags , N_ ("use commit stored in the index instead of the one stored in the submodule HEAD" ), OPT_CACHED ),
728
729
OPT_BIT (0 , "recursive" , & info .flags , N_ ("recurse into nested submodules" ), OPT_RECURSIVE ),
@@ -3395,7 +3396,7 @@ int cmd_submodule__helper(int argc, const char **argv, const char *prefix)
3395
3396
subcmd = argv [0 ];
3396
3397
3397
3398
if (strcmp (subcmd , "clone" ) && strcmp (subcmd , "update" ) &&
3398
- strcmp ( subcmd , "status" ) && get_super_prefix ())
3399
+ get_super_prefix ())
3399
3400
/*
3400
3401
* xstrfmt() rather than "%s %s" to keep the translated
3401
3402
* string identical to git.c's.
0 commit comments