From: Stefan Beller Date: Thu, 5 May 2016 19:52:32 +0000 (-0700) Subject: submodule deinit: require '--all' instead of '.' for all submodules X-Git-Tag: v2.9.0-rc0~41^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f6a527997743b79d6986a16313a7488cfc53d123?hp=f6a527997743b79d6986a16313a7488cfc53d123 submodule deinit: require '--all' instead of '.' for all submodules The discussion in [1] pointed out that '.' is a faulty suggestion as there is a corner case where it fails: > "submodule deinit ." may have "worked" in the sense that you would > have at least one path in your tree and avoided this "nothing > matches" most of the time. It would have still failed with the > exactly same error if run in an empty repository, i.e. > > $ E=/var/tmp/x/empty && rm -fr "$E" && mkdir -p "$E" && cd "$E" > $ git init > $ rungit v2.6.6 submodule deinit . > error: pathspec '.' did not match any file(s) known to git. > Did you forget to 'git add'? > $ >file && git add file > $ rungit v2.6.6 submodule deinit . > $ echo $? > 0 So instead of a pathspec add the '--all' option to deinit all submodules and add a test to check for the corner case of an empty repository. The code only needs to learn about the '--all' option and doesn't require further changes as `git submodule--helper list "$@"` will list all submodules when "$@" is empty. [1] http://news.gmane.org/gmane.comp.version-control.git/289535 Helped-by: Junio C Hamano Signed-off-by: Stefan Beller Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano ---