summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9e58504)
raw | patch | inline | side by side (parent: 9e58504)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Mon, 16 Jan 2012 09:46:14 +0000 (16:46 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 17 Jan 2012 00:26:26 +0000 (16:26 -0800) |
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>
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>
builtin/clone.c | patch | blob | history | |
t/t5500-fetch-pack.sh | patch | blob | history | |
t/t5706-clone-branch.sh | patch | blob | history |
diff --git a/builtin/clone.c b/builtin/clone.c
index 253a7946ce4c82a4021565e49fed39befbd82192..3cfedb3a93be673e46bf753c40d1012fca1faf5c 100644 (file)
--- a/builtin/clone.c
+++ b/builtin/clone.c
} 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,
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;
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 7e85c71ad10186709b4210ca94d88953a270f123..5237066140bc41632ed38541acdf3c30a7a0534d 100755 (executable)
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
test_cmp count3.expected count3.actual
'
-test_expect_success 'clone shallow with nonexistent --branch' '
- git clone --depth 1 --branch Z "file://$(pwd)/." shallow4 &&
- GIT_DIR=shallow4/.git git rev-parse HEAD >actual &&
- git rev-parse HEAD >expected &&
- test_cmp expected actual
-'
-
test_expect_success 'clone shallow with detached HEAD' '
git checkout HEAD^ &&
git clone --depth 1 "file://$(pwd)/." shallow5 &&
index f3f9a76056d25fa7d5e4823b1d05ebc1edff46cc..56be67e07e3c20f029a0bdeb2179e219ebc0bda1 100755 (executable)
--- a/t/t5706-clone-branch.sh
+++ b/t/t5706-clone-branch.sh
)
'
-test_expect_success 'clone -b with bogus branch chooses HEAD' '
- git clone -b bogus parent clone-bogus &&
- (cd clone-bogus &&
- check_HEAD master &&
- check_file one
- )
+test_expect_success 'clone -b with bogus branch' '
+ test_must_fail git clone -b bogus parent clone-bogus
'
test_done