Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions wpiformat/wpiformat/task.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Task base classes for wpiformat."""

from abc import ABCMeta, abstractmethod
import os
import subprocess


class Task(metaclass=ABCMeta):
Expand Down Expand Up @@ -29,12 +29,12 @@ def get_repo_root():

An empty string is returned if no repository root was found.
"""
current_dir = os.path.abspath(os.getcwd())
while current_dir != os.path.dirname(current_dir):
if os.path.exists(current_dir + os.sep + ".git"):
return current_dir
current_dir = os.path.dirname(current_dir)
return ""
return subprocess.run(
["git", "rev-parse", "--show-toplevel"],
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
encoding="ascii",
).stdout.rstrip()

@staticmethod
def should_process_file(config_file, name):
Expand Down