Browse Source

clone: detect and fail on excess parameters

"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>
maint
Junio C Hamano 17 years ago
parent
commit
a2b26acd7a
  1. 1
      git-clone.sh
  2. 26
      t/t5601-clone.sh

1
git-clone.sh

@ -219,6 +219,7 @@ fi
if test -n "$2" if test -n "$2"
then then
dir="$2" dir="$2"
test $# == 2 || die "excess parameter to git-clone"
else else
# Derive one from the repository name # Derive one from the repository name
# Try using "humanish" part of source repo if user didn't specify one # Try using "humanish" part of source repo if user didn't specify one

26
t/t5601-clone.sh

@ -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
Loading…
Cancel
Save