summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-06-02 20:35:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-06-02 20:35:04 (GMT)
commitde82fb45db72fb425fd5d4af81955e48349c2816 (patch)
tree881482ed79847d8b6af1f8d6df0c44aa96fa2679 /builtin
parent202a2b8e71708825a1bba3c8775206d58e422511 (diff)
parentbb2198fb91ada94cfc6f8ec81b9dadcf3959fe10 (diff)
downloadgit-de82fb45db72fb425fd5d4af81955e48349c2816.zip
git-de82fb45db72fb425fd5d4af81955e48349c2816.tar.gz
git-de82fb45db72fb425fd5d4af81955e48349c2816.tar.bz2
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 e9d111b..24336e1 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);