summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-06-02 13:35:04 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-06-02 13:35:04 -0700
commitde82fb45db72fb425fd5d4af81955e48349c2816 (patch)
tree881482ed79847d8b6af1f8d6df0c44aa96fa2679 /builtin
parentMerge branch 'lo/sparse-universal-zero-init' (diff)
parentcheckout: improve error messages for -b with extra argument (diff)
downloadtgif-de82fb45db72fb425fd5d4af81955e48349c2816.tar.xz
Merge branch 'rs/checkout-b-track-error'
The error message from "git checkout -b foo -t bar baz" was confusing. * rs/checkout-b-track-error: checkout: improve error messages for -b with extra argument checkout: add tests for -b and --track
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index e9d111bb83..24336e1017 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1689,7 +1689,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
* Try to give more helpful suggestion.
* new_branch && argc > 1 will be caught later.
*/
- if (opts->new_branch && argc == 1)
+ if (opts->new_branch && argc == 1 && !new_branch_info.commit)
die(_("'%s' is not a commit and a branch '%s' cannot be created from it"),
argv[0], opts->new_branch);