Skip to content

Commit 7e92904

Browse files
committed
lib should not allow named branches
1 parent 13bc031 commit 7e92904

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mbed/mbed.py

+6
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,12 @@ def fromlib(cls, lib=None):
10581058
m_local = re.match(regex_local_ref, ref.strip().replace('\\', '/'))
10591059
m_repo_ref = re.match(regex_url_ref, ref.strip().replace('\\', '/'))
10601060
m_bld_ref = re.match(regex_build_url, ref.strip().replace('\\', '/'))
1061+
1062+
if m_repo_ref:
1063+
rev = m_repo_ref.group(3)
1064+
if rev and not re.match(r'^([a-fA-F0-9]{6,40})$', rev):
1065+
error('named branches not allowed in .lib, offending lib is {} '.format(os.path.basename(lib)))
1066+
10611067
if not (m_local or m_bld_ref or m_repo_ref):
10621068
warning(
10631069
"File \"%s\" in \"%s\" uses a non-standard .lib file extension, which is not compatible with the mbed build tools.\n" % (os.path.basename(lib), os.path.split(lib)[0]))

0 commit comments

Comments
 (0)