summaryrefslogtreecommitdiff
path: root/GitRepo.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-10 02:29:58 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-10 02:29:58 -0400
commit11ad93f023fa5e867b5b7bd47f45393caceb401a (patch)
treeed654ecdbe699372fbc266aba888c434aba9a9ea /GitRepo.hs
parent058cef945023843219e09d4cec80bb7e137b9876 (diff)
reorg
Diffstat (limited to 'GitRepo.hs')
-rw-r--r--GitRepo.hs44
1 files changed, 23 insertions, 21 deletions
diff --git a/GitRepo.hs b/GitRepo.hs
index 2e2c1d52b..8737d8251 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -14,6 +14,26 @@ stateLoc = ".git-annex"
gitStateDir :: String -> String
gitStateDir repo = repo ++ "/" ++ stateLoc ++ "/"
+{- Path to the current repository's gitattributes file. -}
+gitAttributes :: IO String
+gitAttributes = do
+ repo <- repoTop
+ bare <- isBareRepo repo
+ if (bare)
+ then return $ repo ++ "/info/.gitattributes"
+ else return $ repo ++ "/.gitattributes"
+
+{- Path to the current repository's .git directory.
+ - (For a bare repository, that is the root of the repository.)
+ - TODO: support GIT_DIR -}
+gitDir :: IO String
+gitDir = do
+ repo <- repoTop
+ bare <- isBareRepo repo
+ if (bare)
+ then return $ repo
+ else return $ repo ++ "/.git"
+
{- Given a relative or absolute filename, calculates the name to use
- relative to a git repository directory (which must be absolute).
- This is the same form displayed and used by git. -}
@@ -41,29 +61,11 @@ gitPrep = do
else do
content <- readFile attributes
if (all (/= attrLine) (lines content))
- then appendFile attributes $ attrLine ++ "\n"
+ then do
+ appendFile attributes $ attrLine ++ "\n"
+ -- TODO check attributes file into git?
else return ()
-{- Returns the path to the current repository's gitattributes file. -}
-gitAttributes :: IO String
-gitAttributes = do
- repo <- repoTop
- bare <- isBareRepo repo
- if (bare)
- then return $ repo ++ "/info/.gitattributes"
- else return $ repo ++ "/.gitattributes"
-
-{- Returns the path to the current repository's .git directory.
- - (For a bare repository, that is the root of the repository.)
- - TODO: support GIT_DIR -}
-gitDir :: IO String
-gitDir = do
- repo <- repoTop
- bare <- isBareRepo repo
- if (bare)
- then return $ repo
- else return $ repo ++ "/.git"
-
{- Finds the top of the current git repository, which may be in a parent
- directory. -}
repoTop :: IO String