summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2012-01-16 09:46:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-01-17 00:26:26 (GMT)
commit920b691fe4da8115f9b79901411c0cc5fff17efe (patch)
treeef81f364cbcac0365fd7bf0cd6e3247dc0d515c8 /builtin/clone.c
parent9e5850460164f49dc9ae47569838084f5572846d (diff)
downloadgit-920b691fe4da8115f9b79901411c0cc5fff17efe.zip
git-920b691fe4da8115f9b79901411c0cc5fff17efe.tar.gz
git-920b691fe4da8115f9b79901411c0cc5fff17efe.tar.bz2
clone: refuse to clone if --branch points to bogus ref
It's possible that users make a typo in the branch name. Stop and let users recheck. Falling back to remote's HEAD is not documented any way. Except when using remote helper, the pack has not been transferred at this stage yet so we don't waste much bandwidth. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clone.c')
-rw-r--r--builtin/clone.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 253a794..3cfedb3 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -518,8 +518,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
} else if (remote) {
/*
* We know remote HEAD points to a non-branch, or
- * HEAD points to a branch but we don't know which one, or
- * we asked for a specific branch but it did not exist.
+ * HEAD points to a branch but we don't know which one.
* Detach HEAD in all these cases.
*/
update_ref(msg, "HEAD", remote->old_sha1,
@@ -816,12 +815,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
our_head_points_at =
find_remote_branch(mapped_refs, option_branch);
- if (!our_head_points_at) {
- warning(_("Remote branch %s not found in "
- "upstream %s, using HEAD instead"),
- option_branch, option_origin);
- our_head_points_at = remote_head_points_at;
- }
+ if (!our_head_points_at)
+ die(_("Remote branch %s not found in upstream %s"),
+ option_branch, option_origin);
}
else
our_head_points_at = remote_head_points_at;