From: Junio C Hamano Date: Wed, 23 Apr 2008 17:53:47 +0000 (-0700) Subject: clone: detect and fail on excess parameters X-Git-Tag: v1.5.5.2~16 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a2b26acd7afb4d77d8844ccd681e993f25e75205;p=git.git 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 --- diff --git a/git-clone.sh b/git-clone.sh index 2636159aa..9e433c080 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -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 diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh new file mode 100755 index 000000000..dc9d63dbf --- /dev/null +++ b/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