From 43722c4d9e04b3749372b13598b32cdceb1f1252 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Mon, 28 Jan 2013 08:18:15 +0700 Subject: [PATCH] branch: give a more helpful message on redundant arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/branch.c | 4 ++-- t/t3200-branch.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index 50fcaccab0..531a21e831 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -859,7 +859,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) else if (argc == 1) branch_name = argv[0]; else - usage_with_options(builtin_branch_usage, options); + die(_("cannot edit description of more than one branch")); strbuf_addf(&branch_ref, "refs/heads/%s", branch_name); if (!ref_exists(branch_ref.buf)) { @@ -881,7 +881,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix) else if (argc == 2) rename_branch(argv[0], argv[1], rename > 1); else - usage_with_options(builtin_branch_usage, options); + die(_("too many branches for a rename operation")); } else if (new_upstream) { struct branch *branch = branch_get(argv[0]); diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 80e6be39d7..f3e0e4a38c 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -73,8 +73,8 @@ test_expect_success \ test_expect_success \ 'git branch -m dumps usage' \ - 'test_expect_code 129 git branch -m 2>err && - test_i18ngrep "[Uu]sage: git branch" err' + 'test_expect_code 128 git branch -m 2>err && + test_i18ngrep "too many branches for a rename operation" err' test_expect_success \ 'git branch -m m m/m should work' \ -- 2.11.4.GIT