Skip to content

Commit e2c7a5b

Browse files
committed
Merge branch 'rr/maint-submodule-unknown-cmd' into maint
"git submodule frotz" was not diagnosed as "frotz" being an unknown subcommand to "git submodule"; the user instead got a complaint that "git submodule status" was run with an unknown path "frotz". * rr/maint-submodule-unknown-cmd: submodule: if $command was not matched, don't parse other args
2 parents 0a65df5 + af9c9f9 commit e2c7a5b

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Documentation/git-submodule.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ status::
112112
initialized, `+` if the currently checked out submodule commit
113113
does not match the SHA-1 found in the index of the containing
114114
repository and `U` if the submodule has merge conflicts.
115-
This command is the default command for 'git submodule'.
116115
+
117116
If `--recursive` is specified, this command will recurse into nested
118117
submodules, and show their status as well.

git-submodule.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,15 @@ do
11071107
done
11081108

11091109
# No command word defaults to "status"
1110-
test -n "$command" || command=status
1110+
if test -z "$command"
1111+
then
1112+
if test $# = 0
1113+
then
1114+
command=status
1115+
else
1116+
usage
1117+
fi
1118+
fi
11111119

11121120
# "-b branch" is accepted only by "add"
11131121
if test -n "$branch" && test "$command" != add

t/t7400-submodule-basic.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ test_expect_success 'moving to a commit without submodule does not leave empty d
438438
git checkout second
439439
'
440440

441-
test_expect_success 'submodule <invalid-path> warns' '
442-
test_failure_with_unknown_submodule
441+
test_expect_success 'submodule <invalid-subcommand> fails' '
442+
test_must_fail git submodule no-such-subcommand
443443
'
444444

445445
test_expect_success 'add submodules without specifying an explicit path' '

0 commit comments

Comments
 (0)