Skip to content

Commit

Permalink
Merge branch 'rr/maint-submodule-unknown-cmd' into maint
Browse files Browse the repository at this point in the history
"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
  • Loading branch information
Junio C Hamano committed Oct 2, 2012
2 parents 0a65df5 + af9c9f9 commit e2c7a5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion Documentation/git-submodule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ status::
initialized, `+` if the currently checked out submodule commit
does not match the SHA-1 found in the index of the containing
repository and `U` if the submodule has merge conflicts.
This command is the default command for 'git submodule'.
+
If `--recursive` is specified, this command will recurse into nested
submodules, and show their status as well.
Expand Down
10 changes: 9 additions & 1 deletion git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,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
Expand Down
4 changes: 2 additions & 2 deletions t/t7400-submodule-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@ test_expect_success 'moving to a commit without submodule does not leave empty d
git checkout second
'

test_expect_success 'submodule <invalid-path> warns' '
test_failure_with_unknown_submodule
test_expect_success 'submodule <invalid-subcommand> fails' '
test_must_fail git submodule no-such-subcommand
'

test_expect_success 'add submodules without specifying an explicit path' '
Expand Down

0 comments on commit e2c7a5b

Please sign in to comment.