diff --git a/src/Lib.hs b/src/Lib.hs index 4dd94e6..781b259 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -130,13 +130,12 @@ someFunc prefixPath src'' dst = do removePathForcibly dbDst >> createDirectoryIfMissing True dbDst let (Dir name entries) = anchored' ^. _dirTree putStrLn "===============================" - putStrLn $ "canonical src : " ++ src - putStrLn $ "dst : " ++ dst - putStrLn $ "Prefix : " ++ prefixPath - putStrLn $ "Name of src dir : " ++ name + putStrLn $ "canonical src :" ++ src + putStrLn $ "dst :" ++ dst + putStrLn $ "Prefix :" ++ prefixPath + putStrLn $ "Name of src dir :" ++ name putStrLn "===============================" creationTimeForFiles <- mapKeys (name ) <$> creationTime src - print creationTimeForFiles mapM_ (writeJson dbDst) (flatten (makeTr creationTimeForFiles name "" entries)) subInlineMathBlock :: Text -> Text diff --git a/src/MyGit.hs b/src/MyGit.hs index cb65173..70cf738 100644 --- a/src/MyGit.hs +++ b/src/MyGit.hs @@ -33,12 +33,17 @@ withPointers f = alloca $ \x -> do f (Pointers x y z) creationTime :: FilePath -> IO (Map FilePath Integer) -creationTime fp = withLibGitDo $ do - dotGitPath <- canonicalizePath =<< getDotGitPath fp +creationTime src = withLibGitDo $ do + dotGitPath <- canonicalizePath =<< getDotGitPath src repoPath <- canonicalizePath $ takeDirectory dotGitPath - let require = makeRelative repoPath fp - withCString dotGitPath $ \cfp -> do - withPointers (func require cfp) + let require = if repoPath == src then "" else makeRelative repoPath src + withCString dotGitPath $ \csrc -> do + putStrLn "============================" + putStrLn $ "src :" ++ src + putStrLn $ "require :" ++ require + putStrLn $ "repoPath :" ++ repoPath + putStrLn "============================" + withPointers (func require csrc) getDotGitPath :: FilePath -> IO FilePath getDotGitPath fp = do @@ -88,7 +93,6 @@ makeEntryMap'' require repo prefix time entry = do if require `isPrefixOf` prefix then do let relPath = makeRelative require (prefix ++ name) - putStrLn $ "Relative: " ++ relPath return $ Map.singleton relPath time else return Map.empty @@ -105,7 +109,6 @@ makeEntryMap require commit = do c'git_commit_tree treeP commit >>= errorCheck tree <- peek treeP time <- c'git_commit_time commit - putStrLn $ "Require is : " ++ require makeEntryMap' require "" (toInteger time) tree errorCheck r = when (r /= 0) $ error "fail"