When initializing a directory special remote with a relative path, the path is made absolute.

Using a relative path would work, until the user changed to some other
directory in the repo and tried to access the remote from there..
This commit is contained in:
Joey Hess 2013-05-06 17:15:36 -04:00
parent b9b5ba7edb
commit a0f6dab8de
2 changed files with 6 additions and 3 deletions

View file

@ -68,13 +68,14 @@ directorySetup u c = do
-- verify configuration is sane
let dir = fromMaybe (error "Specify directory=") $
M.lookup "directory" c
liftIO $ unlessM (doesDirectoryExist dir) $
error $ "Directory does not exist: " ++ dir
absdir <- liftIO $ absPath dir
liftIO $ unlessM (doesDirectoryExist absdir) $
error $ "Directory does not exist: " ++ absdir
c' <- encryptionSetup c
-- The directory is stored in git config, not in this remote's
-- persistant state, so it can vary between hosts.
gitConfigSpecialRemote u c' "directory" dir
gitConfigSpecialRemote u c' "directory" absdir
return $ M.delete "directory" c'
{- Locations to try to access a given Key in the Directory.