Skip to content

Commit

Permalink
clone: detect and fail on excess parameters
Browse files Browse the repository at this point in the history
"git clone [options] $src $dst excess-garbage" simply ignored
excess-garbage without giving any diagnostic message.  Fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Apr 28, 2008
1 parent 5736a37 commit a2b26ac
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ fi
if test -n "$2"
then
dir="$2"
test $# == 2 || die "excess parameter to git-clone"
else
# Derive one from the repository name
# Try using "humanish" part of source repo if user didn't specify one
Expand Down
26 changes: 26 additions & 0 deletions t/t5601-clone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

test_description=clone

. ./test-lib.sh

test_expect_success setup '
rm -fr .git &&
test_create_repo src &&
(
cd src
>file
git add file
git commit -m initial
)
'

test_expect_success 'clone with excess parameters' '
test_must_fail git clone -n "file://$(pwd)/src" dst junk
'

test_done

0 comments on commit a2b26ac

Please sign in to comment.