diff --git a/Data/Git/Revision.hs b/Data/Git/Revision.hs
--- a/Data/Git/Revision.hs
+++ b/Data/Git/Revision.hs
@@ -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
diff --git a/Data/Git/Storage.hs b/Data/Git/Storage.hs
--- a/Data/Git/Storage.hs
+++ b/Data/Git/Storage.hs
@@ -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.
 --
diff --git a/Data/Git/Storage/FileWriter.hs b/Data/Git/Storage/FileWriter.hs
--- a/Data/Git/Storage/FileWriter.hs
+++ b/Data/Git/Storage/FileWriter.hs
@@ -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 }) =
diff --git a/Tests/Repo.hs b/Tests/Repo.hs
--- a/Tests/Repo.hs
+++ b/Tests/Repo.hs
@@ -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)
diff --git a/hit.cabal b/hit.cabal
--- a/hit.cabal
+++ b/hit.cabal
@@ -1,5 +1,5 @@
 Name:                hit
-Version:             0.4.1
+Version:             0.4.2
 Synopsis:            Git operations in haskell
 Description:
     .
