Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRalf Thielow <ralf.thielow@gmail.com>2013-10-11 20:49:02 +0400
committerJonathan Nieder <jrnieder@gmail.com>2013-10-14 23:26:15 +0400
commita3552aba55b9ed2860b8eb0581c73fc0e996369d (patch)
tree477c770accebb6ca80cea13f40fc3b079e0458da /t
parent02a110ad435a6ccda648f09f94e546dfd7bdd0ac (diff)
clone --branch: refuse to clone if upstream repo is empty
Since 920b691 (clone: refuse to clone if --branch points to bogus ref) we refuse to clone with option "-b" if the specified branch does not exist in the (non-empty) upstream. If the upstream repository is empty, the branch doesn't exist, either. So refuse the clone too. Reported-by: Robert Mitwicki <robert.mitwicki@opensoftware.pl> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5706-clone-branch.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/t/t5706-clone-branch.sh b/t/t5706-clone-branch.sh
index 56be67e07e..6e7a7be052 100755
--- a/t/t5706-clone-branch.sh
+++ b/t/t5706-clone-branch.sh
@@ -20,7 +20,9 @@ test_expect_success 'setup' '
echo one >file && git add file && git commit -m one &&
git checkout -b two &&
echo two >file && git add file && git commit -m two &&
- git checkout master)
+ git checkout master) &&
+ mkdir empty &&
+ (cd empty && git init)
'
test_expect_success 'vanilla clone chooses HEAD' '
@@ -61,4 +63,8 @@ test_expect_success 'clone -b with bogus branch' '
test_must_fail git clone -b bogus parent clone-bogus
'
+test_expect_success 'clone -b not allowed with empty repos' '
+ test_must_fail git clone -b branch empty clone-branch-empty
+'
+
test_done