packages feed

hit 0.4.1 → 0.4.2

raw patch · 5 files changed

+36/−3 lines, 5 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Data.Git.Revision: instance Show RevModifier
+ Data.Git.Revision: instance Show Revision
+ Data.Git.Storage: findRepoMaybe :: IO (Maybe FilePath)

Files

Data/Git/Revision.hs view
@@ -22,8 +22,19 @@         | RevModAtN Int          -- ^ @{n} accessor         deriving (Eq) +instance Show RevModifier where+    show (RevModParent 1)       = "^"+    show (RevModParent n)       = "^" ++ show n+    show (RevModParentFirstN n) = "~" ++ show n+    show (RevModAtType s)       = "@{" ++ s ++ "}"+    show (RevModAtDate s)       = "@{" ++ s ++ "}"+    show (RevModAtN s)          = "@{" ++ show s ++ "}"+ data Revision = Revision String [RevModifier]         deriving (Eq)++instance Show Revision where+    show (Revision s ms) = s ++ concatMap show ms  instance IsString Revision where     fromString = revFromString
Data/Git/Storage.hs view
@@ -16,6 +16,7 @@     , closeRepo     , withRepo     , withCurrentRepo+    , findRepoMaybe     , findRepo     , isRepo     , initRepo@@ -87,6 +88,23 @@         mapM_ (closeIndexReader . snd) =<< readIORef ireaders         mapM_ (fileReaderClose . snd) =<< readIORef preaders         where closeIndexReader (PackIndexReader _ fr) = fileReaderClose fr++-- | Find the git repository from the current directory.+--+-- If the environment variable GIT_DIR is set then it's used,+-- otherwise iterate from current directory, up to 128 parents for a .git directory+findRepoMaybe :: IO (Maybe FilePath)+findRepoMaybe = do+    menvDir <- E.catch (Just . decodeString posix_ghc704 <$> getEnv "GIT_DIR") (\(_:: SomeException) -> return Nothing)+    case menvDir of+        Nothing     -> getWorkingDirectory >>= checkDir 0+        Just envDir -> isRepo envDir >>= \e -> return (if e then Just envDir else Nothing)+    where checkDir :: Int -> FilePath -> IO (Maybe FilePath)+          checkDir 128 _  = return Nothing+          checkDir n   wd = do+              let filepath = wd </> ".git"+              e <- isRepo filepath+              if e then return (Just filepath) else checkDir (n+1) (if absolute wd then parent wd else wd </> "..")  -- | Find the git repository from the current directory. --
Data/Git/Storage/FileWriter.hs view
@@ -42,7 +42,7 @@ postDeflate handle = maybe (return ()) (B.hPut handle)  fileWriterOutput (FileWriter { writerHandle = handle, writerDigest = digest, writerDeflate = deflate }) bs = do-        modifyIORef digest (\ctx -> SHA1.update ctx bs)+        modifyIORef' digest (\ctx -> SHA1.update ctx bs)         (>>= postDeflate handle) =<< feedDeflate deflate bs  fileWriterClose (FileWriter { writerHandle = handle, writerDeflate = deflate }) =
Tests/Repo.hs view
@@ -23,7 +23,11 @@ import Text.Bytedump import System.Exit -onLocalRepo f = withCurrentRepo f+onLocalRepo f = do+    fpath <- findRepoMaybe+    case fpath of+        Nothing -> putStrLn "cannot run this test without repository. clone the original repository for test"+        Just _  -> withCurrentRepo f  doLocalMarshallEq git = do      prefixes <- looseEnumeratePrefixes (gitRepoPath git)
hit.cabal view
@@ -1,5 +1,5 @@ Name:                hit-Version:             0.4.1+Version:             0.4.2 Synopsis:            Git operations in haskell Description:     .