aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/clone.c12
-rwxr-xr-xt/t5500-fetch-pack.sh7
-rwxr-xr-xt/t5706-clone-branch.sh8
3 files changed, 6 insertions, 21 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 253a7946c..3cfedb3a9 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;
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 7e85c71ad..523706614 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -282,13 +282,6 @@ test_expect_success 'clone shallow object count' '
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 &&
diff --git a/t/t5706-clone-branch.sh b/t/t5706-clone-branch.sh
index f3f9a7605..56be67e07 100755
--- a/t/t5706-clone-branch.sh
+++ b/t/t5706-clone-branch.sh
@@ -57,12 +57,8 @@ test_expect_success 'clone -b does not munge remotes/origin/HEAD' '
)
'
-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