Skip to content

Commit

Permalink
answers-db test done
Browse files Browse the repository at this point in the history
  • Loading branch information
ingun37 committed Apr 18, 2023
1 parent 37c1898 commit 47cebfb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
9 changes: 4 additions & 5 deletions src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 10 additions & 7 deletions src/MyGit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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"
Expand Down

0 comments on commit 47cebfb

Please sign in to comment.