Mesa (master): pick-ui: make .pick_status.json path relative to the git root instead of the script

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 21 01:23:17 UTC 2020


Module: Mesa
Branch: master
Commit: 32451a15ecb6b4bb42a2b77d5125eeb1163beea2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=32451a15ecb6b4bb42a2b77d5125eeb1163beea2

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Tue Mar 10 11:12:58 2020 +0100

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 <eric at engestrom.ch>
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4649>

---

 bin/pick/core.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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):



More information about the mesa-commit mailing list