deal with git using / internally, even on DOS
This commit is contained in:
parent
a2f83b28f3
commit
73d2f8b280
6 changed files with 40 additions and 8 deletions
3
Annex/CatFile.hs
Normal file → Executable file
3
Annex/CatFile.hs
Normal file → Executable file
|
@ -21,6 +21,7 @@ import qualified Git
|
|||
import qualified Git.CatFile
|
||||
import qualified Annex
|
||||
import Git.Types
|
||||
import Git.FilePath
|
||||
|
||||
catFile :: Git.Branch -> FilePath -> Annex L.ByteString
|
||||
catFile branch file = do
|
||||
|
@ -48,7 +49,7 @@ catFileHandle = maybe startup return =<< Annex.getState Annex.catfilehandle
|
|||
{- From the Sha or Ref of a symlink back to the key. -}
|
||||
catKey :: Ref -> Annex (Maybe Key)
|
||||
catKey ref = do
|
||||
l <- encodeW8 . L.unpack <$> catObject ref
|
||||
l <- fromInternalGitPath . encodeW8 . L.unpack <$> catObject ref
|
||||
return $ if isLinkToAnnex l
|
||||
then fileKey $ takeFileName l
|
||||
else Nothing
|
||||
|
|
4
Annex/Link.hs
Normal file → Executable file
4
Annex/Link.hs
Normal file → Executable file
|
@ -18,6 +18,7 @@ import qualified Git.HashObject
|
|||
import qualified Git.UpdateIndex
|
||||
import qualified Annex.Queue
|
||||
import Git.Types
|
||||
import Git.FilePath
|
||||
|
||||
type LinkTarget = String
|
||||
|
||||
|
@ -74,7 +75,8 @@ addAnnexLink linktarget file = do
|
|||
|
||||
{- Injects a symlink target into git, returning its Sha. -}
|
||||
hashSymlink :: LinkTarget -> Annex Sha
|
||||
hashSymlink linktarget = inRepo $ Git.HashObject.hashObject BlobObject linktarget
|
||||
hashSymlink linktarget = inRepo $ Git.HashObject.hashObject BlobObject $
|
||||
toInternalGitPath linktarget
|
||||
|
||||
{- Stages a symlink to the annex, using a Sha of its target. -}
|
||||
stageSymlink :: FilePath -> Sha -> Annex ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue