summaryrefslogtreecommitdiff
path: root/GitRepo.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-09 23:35:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-09 23:35:05 -0400
commit381e6f84e5f4ddc64ed86f08064ebaf2313b18db (patch)
treeb1adc6b70db80856275db0b0328cb484996093ab /GitRepo.hs
parent011118dbdff84458a5f9eea05547d79fbf7e88ac (diff)
robustness
Diffstat (limited to 'GitRepo.hs')
-rw-r--r--GitRepo.hs13
1 files changed, 3 insertions, 10 deletions
diff --git a/GitRepo.hs b/GitRepo.hs
index 01e6746ae..2e7fff22e 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -6,6 +6,7 @@ import Directory
import System.Directory
import System.Path
import Data.String.Utils
+import Utility
{- Given a relative or absolute filename, calculates the name to use
- relative to a git repository directory (which must be absolute).
@@ -49,16 +50,8 @@ seekUp dir want = do
if ok
then return (Just dir)
else case (parentDir dir) of
- (Just d) -> seekUp d want
- Nothing -> return Nothing
-
-parentDir :: String -> Maybe String
-parentDir dir =
- if length dirs > 0
- then Just ("/" ++ (join "/" $ take ((length dirs) - 1) dirs))
- else Nothing
- where
- dirs = filter (\x -> length x > 0) $ split "/" dir
+ "" -> return Nothing
+ d -> seekUp d want
isRepoTop dir = do
r <- isGitRepo dir