Skip to content

Commit 76ba390

Browse files
committed
Fixed importing inside git tree (non-program) #211
1 parent 25f8ab1 commit 76ba390

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mbed/mbed.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,9 +1490,10 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, top=True):
14901490

14911491
repo = Repo.fromurl(url, path)
14921492
if top:
1493-
if cwd_type != "directory":
1494-
error("Cannot import program in the specified location \"%s\" because it's already part of a program.\n"
1495-
"Please change your working directory to a different location or use \"mbed add\" to import the URL as a library." % os.path.abspath(repo.path), 1)
1493+
p = Program(path)
1494+
if p and not p.is_cwd:
1495+
error("Cannot import program in the specified location \"%s\" because it's already part of a program \"%s\".\n"
1496+
"Please change your working directory to a different location or use \"mbed add\" to import the URL as a library." % (os.path.abspath(repo.path), p.name), 1)
14961497

14971498
protocol = Program().get_cfg('PROTOCOL', protocol)
14981499

0 commit comments

Comments
 (0)