mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[upstream_utils] Use git to get repo root (#6967)
This commit is contained in:
@@ -65,12 +65,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()
|
||||
|
||||
|
||||
def walk_if(top, pred):
|
||||
|
||||
Reference in New Issue
Block a user