summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jonathon Mah <me@JonathonMah.com>2013-03-30 18:27:44 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-03-31 19:58:02 -0700
commitd1520c4b1a6105356c7a2def6b90239057270598 (patch)
tree04753c6f1192a4c64116f0e41962350848888268
parentMerge branch 'yd/use-test-config-unconfig' (diff)
downloadtgif-d1520c4b1a6105356c7a2def6b90239057270598.tar.xz
branch: give better message when no names specified for rename
Signed-off-by: Jonathon Mah <me@JonathonMah.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/branch.c4
-rwxr-xr-xt/t3200-branch.sh2
2 files changed, 4 insertions, 2 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index 00d17d25d1..580107fd78 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -880,7 +880,9 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
if (edit_branch_description(branch_name))
return 1;
} else if (rename) {
- if (argc == 1)
+ if (!argc)
+ die(_("branch name required"));
+ else if (argc == 1)
rename_branch(head, argv[0], rename > 1);
else if (argc == 2)
rename_branch(argv[0], argv[1], rename > 1);
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 12f1e4a63c..a64c9d2dd3 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -78,7 +78,7 @@ test_expect_success \
test_expect_success \
'git branch -m dumps usage' \
'test_expect_code 128 git branch -m 2>err &&
- test_i18ngrep "too many branches for a rename operation" err'
+ test_i18ngrep "branch name required" err'
test_expect_success \
'git branch -m m m/m should work' \