aboutsummaryrefslogtreecommitdiff
path: root/Git.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-05-06 12:26:37 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-05-06 12:26:44 -0400
commit2de35be7538023dd70e4c4b3ef984d1ae8a4c5a7 (patch)
treeae2da77522f5f5e6b31135bb1ddb55f12694456b /Git.hs
parent7b33a5f2ab57f8546577bdc0532f925a3917fe78 (diff)
Propigate GIT_DIR and GIT_WORK_TREE environment to external special remotes.
Since git-annex unsets these when started, they have to be explicitly propigated. Also, this makes --git-dir and --work-tree settings be reflected in the environment. The need for this came up in https://github.com/DanielDent/git-annex-remote-rclone/issues/3
Diffstat (limited to 'Git.hs')
-rw-r--r--Git.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Git.hs b/Git.hs
index 6f7769c87..b35051523 100644
--- a/Git.hs
+++ b/Git.hs
@@ -26,6 +26,7 @@ module Git (
repoDescribe,
repoLocation,
repoPath,
+ repoWorkTree,
localGitDir,
attributes,
attributesLocal,
@@ -73,6 +74,10 @@ repoPath Repo { location = Local { gitdir = d } } = d
repoPath Repo { location = LocalUnknown dir } = dir
repoPath Repo { location = Unknown } = error "unknown repoPath"
+repoWorkTree :: Repo -> Maybe FilePath
+repoWorkTree Repo { location = Local { worktree = Just d } } = Just d
+repoWorkTree _ = Nothing
+
{- Path to a local repository's .git directory. -}
localGitDir :: Repo -> FilePath
localGitDir Repo { location = Local { gitdir = d } } = d