Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTao Qingyun <taoqy@ls-a.me>2018-10-16 17:54:28 +0300
committerJunio C Hamano <gitster@pobox.com>2018-10-18 04:57:31 +0300
commit8d2008196b4e6100cf90e8392106e82f46cc1a51 (patch)
treee581eff863f2724385a16193bcf2feff843b2b0f /builtin/branch.c
parentcae598d9980661a978e2df4fb338518f7bf09572 (diff)
builtin/branch.c: remove useless branch_get
branch_get sometimes returns current_branch, which can be NULL (e.g., if you're on a detached HEAD). Try: $ git branch HEAD fatal: no such branch 'HEAD' $ git branch '' fatal: no such branch '' However, it seems weird that we'd check those cases here (and provide such lousy messages). And indeed, dropping that and letting us eventually hit create_branch() gives a much better message: $ git branch HEAD fatal: 'HEAD' is not a valid branch name. $ git branch '' fatal: '' is not a valid branch name. Signed-off-by: Tao Qingyun <taoqy@ls-a.me> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/branch.c')
-rw-r--r--builtin/branch.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index bbd006aab4b..daf054598ba 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -828,11 +828,6 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
git_config_set_multivar(buf.buf, NULL, NULL, 1);
strbuf_release(&buf);
} else if (argc > 0 && argc <= 2) {
- struct branch *branch = branch_get(argv[0]);
-
- if (!branch)
- die(_("no such branch '%s'"), argv[0]);
-
if (filter.kind != FILTER_REFS_BRANCHES)
die(_("-a and -r options to 'git branch' do not make sense with a branch name"));