summaryrefslogtreecommitdiffstats
path: root/gita/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'gita/common.py')
-rw-r--r--gita/common.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/gita/common.py b/gita/common.py
index 0a271fc..64116af 100644
--- a/gita/common.py
+++ b/gita/common.py
@@ -2,7 +2,16 @@ import os
def get_config_dir() -> str:
- parent = os.environ.get('XDG_CONFIG_HOME') or os.path.join(
- os.path.expanduser('~'), '.config')
- root = os.path.join(parent, "gita")
- return root
+ root = (
+ os.environ.get("GITA_PROJECT_HOME")
+ or os.environ.get("XDG_CONFIG_HOME")
+ or os.path.join(os.path.expanduser("~"), ".config")
+ )
+ return os.path.join(root, "gita")
+
+
+def get_config_fname(fname: str) -> str:
+ """
+ Return the file name that stores the repo locations.
+ """
+ return os.path.join(get_config_dir(), fname)