summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2020-03-10 11:12:58 +0100
committerMarge Bot <[email protected]>2020-04-21 01:13:53 +0000
commit32451a15ecb6b4bb42a2b77d5125eeb1163beea2 (patch)
tree581cc0b146f07dcd233d936a138ccbcd72009463
parent26a26a358484bf03a6498c4116d8cb496f668cc1 (diff)
pick-ui: make .pick_status.json path relative to the git root instead of the script
This allows the script to be called from another git worktree for instance, which I need for my workflow :) Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4649>
-rw-r--r--bin/pick/core.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/pick/core.py b/bin/pick/core.py
index dbfce46c36f..9b8926224b8 100644
--- a/bin/pick/core.py
+++ b/bin/pick/core.py
@@ -25,6 +25,7 @@ import enum
import json
import pathlib
import re
+import subprocess
import typing
import attr
@@ -55,7 +56,9 @@ SEM = asyncio.Semaphore(50)
COMMIT_LOCK = asyncio.Lock()
-pick_status_json = pathlib.Path(__file__).parent.parent.parent / '.pick_status.json'
+git_toplevel = subprocess.check_output(['git', 'rev-parse', '--show-toplevel'],
+ stderr=subprocess.DEVNULL).decode("ascii").strip()
+pick_status_json = pathlib.Path(git_toplevel) / '.pick_status.json'
class PickUIException(Exception):