Skip to content

Commit 983f24a

Browse files
simpler git repo detection without unix commands
might be enough for #1
1 parent ee194d5 commit 983f24a

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

gitignore_plugin.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,9 @@ def find_git_repos(folder):
131131
Returns a list of all git repos within the given ancestor folder.
132132
"""
133133

134-
# Command for finding git repos nicked from
135-
# http://sixarm.com/about/git-how-to-find-git-repository-directories.html
136-
command_output = subprocess.Popen(
137-
['find', folder, '-type', 'd', '-name', '.git'],
138-
stdout=subprocess.PIPE
139-
).stdout.read()
140-
141-
command_output = command_output.decode('utf-8', 'ignore')
142-
143-
if command_output.isspace() or command_output == u'':
144-
return []
145-
146-
dot_git_folders = command_output.strip().split(u'\n')
147-
148-
return [path.replace(u'/.git', u'') for path in dot_git_folders]
134+
return [root for root, subfolders, files
135+
in os.walk(folder)
136+
if '.git' in subfolders]
149137

150138
def repo_ignored_paths(git_repo):
151139
"""

0 commit comments

Comments
 (0)