diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-13 15:27:38 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-13 15:27:38 -0400 |
commit | 3c851368750a5faf19ff3437854a60ae4c679c69 (patch) | |
tree | 98ee369164626082639bf4721994e23aa815bbf7 | |
parent | 9db8ec210f8491de78cd7e83b94c50ead8049e72 (diff) |
remove dead code
-rw-r--r-- | Git.hs | 31 |
1 files changed, 0 insertions, 31 deletions
@@ -21,7 +21,6 @@ module Git ( repoDescribe, repoLocation, workTree, - workTreeFile, gitDir, urlPath, urlHost, @@ -166,36 +165,6 @@ workTree r@(Repo { location = Url _ }) = urlPath r workTree (Repo { location = Dir d }) = d workTree Repo { location = Unknown } = undefined -{- Given a relative or absolute filename inside a git repository's - - workTree, calculates the name to use to refer to that file to git. - - - - This is complicated because the best choice can vary depending on - - whether the cwd is in a subdirectory of the git repository, or not. - - - - For example, when adding a file "/tmp/repo/foo", it's best to refer - - to it as "foo" if the cwd is outside the repository entirely - - (this avoids a gotcha with using the full path name when /tmp/repo - - is itself a symlink). But, if the cwd is "/tmp/repo/subdir", - - it's best to refer to "../foo". - -} -workTreeFile :: FilePath -> Repo -> IO FilePath -workTreeFile file repo@(Repo { location = Dir d }) = do - cwd <- getCurrentDirectory - let file' = absfile cwd - unless (inrepo file') $ - error $ file ++ " is not located inside git repository " ++ absrepo - if inrepo $ addTrailingPathSeparator cwd - then return $ relPathDirToFile cwd file' - else return $ drop (length absrepo) file' - where - -- normalize both repo and file, so that repo - -- will be substring of file - absrepo = maybe bad addTrailingPathSeparator $ absNormPath "/" d - absfile c = fromMaybe file $ secureAbsNormPath c file - inrepo f = absrepo `isPrefixOf` f - bad = error $ "bad repo" ++ repoDescribe repo -workTreeFile _ repo = assertLocal repo $ error "internal" - {- Path of an URL repo. -} urlPath :: Repo -> String urlPath Repo { location = Url u } = uriPath u |