Escolar Documentos
Profissional Documentos
Cultura Documentos
Products
Desktop products
Synergy
Synergy Advance
WinSwitch
Developer products
atosym
Command-T
Hextrapolate
Install
Walrus
Walrat
Wincent Login Tool
Wincent Strings Utility
WOPublic
WOTest
Server products
Bansshee
Wikitext
Blog
Snippets
Tweets
Wiki
Forums
Support
About
Search
log in
Overview
A Git branch name can not:
Source code
The definitive reference for what is a legal ref name (ie. applies to both tags and branches) is the
implementation of the check_ref_format() function in refs.c, along with bad_ref_char() in the
same file. At the current time of writing (19 September 2010) they read as follows:
static inline int bad_ref_char(int ch)
{
if (((unsigned) ch) <= ' ' ||
ch == '~' || ch == '^' || ch == ':' || ch == '\\')
return 1;
/* 2.13 Pattern Matching Notation */
if (ch == '?' || ch == '[') /* Unsupported */
return 1;
if (ch == '*') /* Supported at the end */
return 2;
return 0;
}
level = 0;
while (1) {
while ((ch = *cp++) == '/')
; /* tolerate duplicated slashes */
if (!ch)
/* should not end with slashes */
return CHECK_REF_FORMAT_ERROR;
last = ch;
/* scan the rest of the path component */
while ((ch = *cp++) != 0) {
bad_type = bad_ref_char(ch);
if (bad_type)
return CHECK_REF_FORMAT_ERROR;
if (ch == '/')
break;
if (last == '.' && ch == '.')
return CHECK_REF_FORMAT_ERROR;
if (last == '@' && ch == '{')
return CHECK_REF_FORMAT_ERROR;
last = ch;
}
level++;
if (!ch) {
if (ref <= cp - 2 && cp[-2] == '.')
return CHECK_REF_FORMAT_ERROR;
if (level < 2)
return CHECK_REF_FORMAT_ONELEVEL;
if (has_extension(ref, ".lock"))
return CHECK_REF_FORMAT_ERROR;
return ret;
}
}
}
Tags
git
wiki index
Comments
Add a comment
add a comment
contact
legal