summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorRalf Thielow <ralf.thielow@gmail.com>2013-10-11 16:49:02 (GMT)
committerJonathan Nieder <jrnieder@gmail.com>2013-10-14 19:26:15 (GMT)
commita3552aba55b9ed2860b8eb0581c73fc0e996369d (patch)
tree477c770accebb6ca80cea13f40fc3b079e0458da /builtin/clone.c
parent02a110ad435a6ccda648f09f94e546dfd7bdd0ac (diff)
downloadgit-a3552aba55b9ed2860b8eb0581c73fc0e996369d.zip
git-a3552aba55b9ed2860b8eb0581c73fc0e996369d.tar.gz
git-a3552aba55b9ed2860b8eb0581c73fc0e996369d.tar.bz2
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 'builtin/clone.c')
-rw-r--r--builtin/clone.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 430307b..21ad9f9 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -946,6 +946,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
our_head_points_at = remote_head_points_at;
}
else {
+ if (option_branch)
+ die(_("Remote branch %s not found in upstream %s"),
+ option_branch, option_origin);
+
warning(_("You appear to have cloned an empty repository."));
mapped_refs = NULL;
our_head_points_at = NULL;