From: Eric Engestrom Date: Tue, 10 Mar 2020 10:12:58 +0000 (+0100) Subject: pick-ui: make .pick_status.json path relative to the git root instead of the script X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32451a15ecb6b4bb42a2b77d5125eeb1163beea2;p=mesa.git 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 Reviewed-by: Dylan Baker Part-of: --- 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):