summaryrefslogtreecommitdiff
path: root/branch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-04-06 07:43:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-04-06 07:43:44 (GMT)
commitfbdc05661d9b732d06c47ccb3d5836d0d1b563e5 (patch)
treeb5e7e00ca449758d6244a382a27e9b967286787a /branch.c
parent03a39a91842cf745e5fc27dbd6485aad44d839a4 (diff)
parent3e262b95c50991de12cc5e180b72256561606a19 (diff)
downloadgit-fbdc05661d9b732d06c47ccb3d5836d0d1b563e5.zip
git-fbdc05661d9b732d06c47ccb3d5836d0d1b563e5.tar.gz
git-fbdc05661d9b732d06c47ccb3d5836d0d1b563e5.tar.bz2
Merge branch 'jc/name-branch'
* jc/name-branch: Don't permit ref/branch names to end with ".lock" check_ref_format(): tighten refname rules strbuf_check_branch_ref(): a helper to check a refname for a branch Fix branch -m @{-1} newname check-ref-format --branch: give Porcelain a way to grok branch shorthand strbuf_branchname(): a wrapper for branch name shorthands Rename interpret/substitute nth_last_branch functions Conflicts: Documentation/git-check-ref-format.txt
Diffstat (limited to 'branch.c')
-rw-r--r--branch.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/branch.c b/branch.c
index 5f889fe..62030af 100644
--- a/branch.c
+++ b/branch.c
@@ -134,16 +134,8 @@ void create_branch(const char *head,
char *real_ref, msg[PATH_MAX + 20];
struct strbuf ref = STRBUF_INIT;
int forcing = 0;
- int len;
- len = strlen(name);
- if (interpret_nth_last_branch(name, &ref) != len) {
- strbuf_reset(&ref);
- strbuf_add(&ref, name, len);
- }
- strbuf_splice(&ref, 0, 0, "refs/heads/", 11);
-
- if (check_ref_format(ref.buf))
+ if (strbuf_check_branch_ref(&ref, name))
die("'%s' is not a valid branch name.", name);
if (resolve_ref(ref.buf, sha1, 1, NULL)) {