summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2012-09-22 11:27:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-09-25 18:31:48 (GMT)
commitaf9c9f97137dfb3f20a17d76520803c0312fd3e4 (patch)
tree8ad5e10520b6cd36497ed07c2fc70dedefbc07e1 /git-submodule.sh
parentbafc478f1618534fcb85bedc0fa224bd2d462441 (diff)
downloadgit-af9c9f97137dfb3f20a17d76520803c0312fd3e4.zip
git-af9c9f97137dfb3f20a17d76520803c0312fd3e4.tar.gz
git-af9c9f97137dfb3f20a17d76520803c0312fd3e4.tar.bz2
submodule: if $command was not matched, don't parse other args
"git submodule" command DWIMs the command line and assumes a unspecified action word for 'status' action. This is a UI mistake that leads to a confusing behaviour. A mistyped command name is instead treated as a request for 'status' of the submodule with that name, e.g. $ git submodule show error: pathspec 'show' did not match any file(s) known to git. Did you forget to 'git add'? Stop DWIMming an unknown or mistyped subcommand name as pathspec given to unspelled "status" subcommand. "git submodule" without any argument is still interpreted as "git submodule status", but its value is questionable. Adjust t7400 to match, and stop advertising the default subcommand being 'status' which does not help much in practice, other than promoting laziness and confusion. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index e89b516..152ad92 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -1056,7 +1056,15 @@ do
done
# No command word defaults to "status"
-test -n "$command" || command=status
+if test -z "$command"
+then
+ if test $# = 0
+ then
+ command=status
+ else
+ usage
+ fi
+fi
# "-b branch" is accepted only by "add"
if test -n "$branch" && test "$command" != add