@matheusbsbs / matheus-bagliano / commits / a2b26acd7a
Fork 0

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>

Junio C Hamano committed Apr 23, 2008 at 10:53 UTC a2b26acd7afb4d77d8844ccd681e993f25e75205
2 files changed +27
git-clone.sh
+1
@@ -219,6 +219,7 @@ fi
219 if test -n "$2"
220 then
221 dir="$2"
222 + test $# == 2 || die "excess parameter to git-clone"
223 else
224 # Derive one from the repository name
225 # Try using "humanish" part of source repo if user didn't specify one
t/t5601-clone.sh new
+26
@@ -0,0 +1,26 @@
1 +#!/bin/sh
2 +
3 +test_description=clone
4 +
5 +. ./test-lib.sh
6 +
7 +test_expect_success setup '
8 +
9 + rm -fr .git &&
10 + test_create_repo src &&
11 + (
12 + cd src
13 + >file
14 + git add file
15 + git commit -m initial
16 + )
17 +
18 +'
19 +
20 +test_expect_success 'clone with excess parameters' '
21 +
22 + test_must_fail git clone -n "file://$(pwd)/src" dst junk
23 +
24 +'
25 +
26 +test_done