where indentation

This commit is contained in:
Joey Hess 2012-10-31 02:34:03 -04:00
parent b8009a68e4
commit 88d1907278
32 changed files with 720 additions and 732 deletions

View file

@ -50,8 +50,7 @@ handleDrops' locs rs fromhere key (Just f)
| checkcopies n = dropr r n >>= go rest | checkcopies n = dropr r n >>= go rest
| otherwise = noop | otherwise = noop
checkdrop n@(_, numcopies) u a = checkdrop n@(_, numcopies) u a = ifM (wantDrop u (Just f))
ifM (wantDrop u (Just f))
( ifM (doCommand $ a (Just numcopies)) ( ifM (doCommand $ a (Just numcopies))
( return $ decrcopies n ( return $ decrcopies n
, return n , return n

View file

@ -47,8 +47,7 @@ ensureInstalled = go =<< standaloneAppBase
#ifdef darwin_HOST_OS #ifdef darwin_HOST_OS
autostartfile <- userAutoStart osxAutoStartLabel autostartfile <- userAutoStart osxAutoStartLabel
#else #else
autostartfile <- autoStartPath "git-annex" autostartfile <- autoStartPath "git-annex" <$> userConfigDir
<$> userConfigDir
#endif #endif
installAutoStart program autostartfile installAutoStart program autostartfile

View file

@ -120,8 +120,8 @@ startOneService client (x:xs) = do
mountChanged :: [MatchRule] mountChanged :: [MatchRule]
mountChanged = [gvfs True, gvfs False, kde, kdefallback] mountChanged = [gvfs True, gvfs False, kde, kdefallback]
where where
{- gvfs reliably generates this event whenever a drive is mounted/unmounted, {- gvfs reliably generates this event whenever a
- whether automatically, or manually -} - drive is mounted/unmounted, whether automatically, or manually -}
gvfs mount = matchAny gvfs mount = matchAny
{ matchInterface = Just "org.gtk.Private.RemoteVolumeMonitor" { matchInterface = Just "org.gtk.Private.RemoteVolumeMonitor"
, matchMember = Just $ if mount then "MountAdded" else "MountRemoved" , matchMember = Just $ if mount then "MountAdded" else "MountRemoved"

View file

@ -84,14 +84,10 @@ checkRepositoryPath p = do
Nothing -> Right $ Just $ T.pack basepath Nothing -> Right $ Just $ T.pack basepath
Just prob -> Left prob Just prob -> Left prob
where where
runcheck (chk, msg) = ifM (chk) runcheck (chk, msg) = ifM (chk) ( return $ Just msg, return Nothing )
( return $ Just msg
, return Nothing
)
expandTilde home ('~':'/':path) = home </> path expandTilde home ('~':'/':path) = home </> path
expandTilde _ path = path expandTilde _ path = path
{- On first run, if run in the home directory, default to putting it in {- On first run, if run in the home directory, default to putting it in
- ~/Desktop/annex, when a Desktop directory exists, and ~/annex otherwise. - ~/Desktop/annex, when a Desktop directory exists, and ~/annex otherwise.
- -
@ -216,8 +212,7 @@ getAddDriveR = bootstrap (Just Config) $ do
addremote dir name = runAnnex undefined $ do addremote dir name = runAnnex undefined $ do
hostname <- maybe "host" id <$> liftIO getHostname hostname <- maybe "host" id <$> liftIO getHostname
hostlocation <- fromRepo Git.repoLocation hostlocation <- fromRepo Git.repoLocation
liftIO $ inDir dir $ liftIO $ inDir dir $ void $ makeGitRemote hostname hostlocation
void $ makeGitRemote hostname hostlocation
addRemote $ makeGitRemote name dir addRemote $ makeGitRemote name dir
getEnableDirectoryR :: UUID -> Handler RepHtml getEnableDirectoryR :: UUID -> Handler RepHtml

View file

@ -144,8 +144,7 @@ getEnableRsyncR u = do
T.pack . concat <$> prettyListUUIDs [u] T.pack . concat <$> prettyListUUIDs [u]
let authtoken = webAppFormAuthToken let authtoken = webAppFormAuthToken
$(widgetFile "configurators/ssh/enable") $(widgetFile "configurators/ssh/enable")
enable sshdata = enable sshdata = lift $ redirect $ ConfirmSshR $
lift $ redirect $ ConfirmSshR $
sshdata { rsyncOnly = True } sshdata { rsyncOnly = True }
{- Converts a rsyncurl value to a SshInput. But only if it's a ssh rsync {- Converts a rsyncurl value to a SshInput. But only if it's a ssh rsync
@ -178,7 +177,7 @@ parseSshRsyncUrl u
- a special ssh key will need to be generated just for this server. - a special ssh key will need to be generated just for this server.
- -
- Once logged into the server, probe to see if git-annex-shell is - Once logged into the server, probe to see if git-annex-shell is
- available, or rsync. Note that on OSX, ~/.ssh/git-annex-shell may be - available, or rsync. Note that, ~/.ssh/git-annex-shell may be
- present, while git-annex-shell is not in PATH. - present, while git-annex-shell is not in PATH.
-} -}
testServer :: SshInput -> IO (Either ServerStatus SshData) testServer :: SshInput -> IO (Either ServerStatus SshData)
@ -194,8 +193,7 @@ testServer sshinput@(SshInput { hostname = Just hn }) = do
then ret status' True then ret status' True
else return $ Left status' else return $ Left status'
where where
ret status needspubkey = return $ Right $ ret status needspubkey = return $ Right $ (mkSshData sshinput)
(mkSshData sshinput)
{ needsPubKey = needspubkey { needsPubKey = needspubkey
, rsyncOnly = status == UsableRsyncServer , rsyncOnly = status == UsableRsyncServer
} }
@ -204,7 +202,7 @@ testServer sshinput@(SshInput { hostname = Just hn }) = do
[ report "loggedin" [ report "loggedin"
, checkcommand "git-annex-shell" , checkcommand "git-annex-shell"
, checkcommand "rsync" , checkcommand "rsync"
, checkcommand osx_shim , checkcommand shim
] ]
knownhost <- knownHost hn knownhost <- knownHost hn
let sshopts = filter (not . null) $ extraopts ++ let sshopts = filter (not . null) $ extraopts ++
@ -219,7 +217,7 @@ testServer sshinput@(SshInput { hostname = Just hn }) = do
parsetranscript . fst <$> sshTranscript sshopts "" parsetranscript . fst <$> sshTranscript sshopts ""
parsetranscript s parsetranscript s
| reported "git-annex-shell" = UsableSshInput | reported "git-annex-shell" = UsableSshInput
| reported osx_shim = UsableSshInput | reported shim = UsableSshInput
| reported "rsync" = UsableRsyncServer | reported "rsync" = UsableRsyncServer
| reported "loggedin" = UnusableServer | reported "loggedin" = UnusableServer
"Neither rsync nor git-annex are installed on the server. Perhaps you should go install them?" "Neither rsync nor git-annex are installed on the server. Perhaps you should go install them?"
@ -230,7 +228,7 @@ testServer sshinput@(SshInput { hostname = Just hn }) = do
checkcommand c = "if which " ++ c ++ "; then " ++ report c ++ "; fi" checkcommand c = "if which " ++ c ++ "; then " ++ report c ++ "; fi"
token r = "git-annex-probe " ++ r token r = "git-annex-probe " ++ r
report r = "echo " ++ token r report r = "echo " ++ token r
osx_shim = "~/.ssh/git-annex-shell" shim = "~/.ssh/git-annex-shell"
{- Runs a ssh command; if it fails shows the user the transcript, {- Runs a ssh command; if it fails shows the user the transcript,
- and if it succeeds, runs an action. -} - and if it succeeds, runs an action. -}

View file

@ -33,8 +33,7 @@ getSwitchToRepositoryR repo = do
startassistant = do startassistant = do
program <- readProgramFile program <- readProgramFile
void $ forkIO $ void $ createProcess $ void $ forkIO $ void $ createProcess $
(proc program ["assistant"]) (proc program ["assistant"]) { cwd = Just repo }
{ cwd = Just repo }
geturl = do geturl = do
r <- Git.Config.read =<< Git.Construct.fromPath repo r <- Git.Config.read =<< Git.Construct.fromPath repo
waiturl $ gitAnnexUrlFile r waiturl $ gitAnnexUrlFile r
@ -46,8 +45,7 @@ getSwitchToRepositoryR repo = do
( return url ( return url
, delayed $ waiturl urlfile , delayed $ waiturl urlfile
) )
listening url = catchBoolIO $ listening url = catchBoolIO $ fst <$> Url.exists url []
fst <$> Url.exists url []
delayed a = do delayed a = do
threadDelay 100000 -- 1/10th of a second threadDelay 100000 -- 1/10th of a second
a a

View file

@ -87,8 +87,7 @@ cancelTransfer pause t = do
| pause = throwTo tid PauseTransfer | pause = throwTo tid PauseTransfer
| otherwise = killThread tid | otherwise = killThread tid
{- In order to stop helper processes like rsync, {- In order to stop helper processes like rsync,
- kill the whole process group of the process running the - kill the whole process group of the process running the transfer. -}
- transfer. -}
killproc pid = do killproc pid = do
g <- getProcessGroupIDOf pid g <- getProcessGroupIDOf pid
void $ tryIO $ signalProcessGroup sigTERM g void $ tryIO $ signalProcessGroup sigTERM g