@@ -81,19 +81,27 @@ def warn_extra_files(dir) -> None:
81
81
print ("and add & commit your new files." , file = sys .stderr )
82
82
83
83
84
+ def chdir_prefix (dir ) -> str :
85
+ """Return the command to change to the target directory, plus '&&'."""
86
+ if os .path .relpath (dir ) != "." :
87
+ return "cd " + pipes .quote (dir ) + " && "
88
+ else :
89
+ return ""
90
+
91
+
84
92
def error_submodule_not_initialized (name : str , dir : str ) -> None :
85
93
print ("Submodule '{}' not initialized." .format (name ), file = sys .stderr )
86
94
print ("Please run:" , file = sys .stderr )
87
- print (" cd {}" .format (pipes . quote ( dir )), file = sys . stderr )
88
- print ( " git submodule init {}" . format ( name ), file = sys .stderr )
95
+ print (" {}git submodule update --init {}" .format (
96
+ chdir_prefix ( dir ), name ), file = sys .stderr )
89
97
90
98
91
99
def error_submodule_not_updated (name : str , dir : str ) -> None :
92
100
print ("Submodule '{}' not updated." .format (name ), file = sys .stderr )
93
101
print ("Please run:" , file = sys .stderr )
94
- print (" cd {}" .format (pipes . quote ( dir )), file = sys . stderr )
95
- print ( " git submodule update {}" . format ( name ), file = sys .stderr )
96
- print ("(If you got this message because you updated {}" .format (name ), file = sys .stderr )
102
+ print (" {}git submodule update {}" .format (
103
+ chdir_prefix ( dir ), name ), file = sys .stderr )
104
+ print ("(If you got this message because you updated {} yourself " .format (name ), file = sys .stderr )
97
105
print (" then run \" git add {}\" to silence this check)" .format (name ), file = sys .stderr )
98
106
99
107
0 commit comments