still do peer-to-peer git push when there are no git remotes

This commit is contained in:
Joey Hess 2014-11-22 15:18:30 -04:00
parent d409014277
commit ef883cbbe8
2 changed files with 5 additions and 2 deletions

View File

@ -42,6 +42,9 @@ hasOrigin = catchDefaultIO False $ do
rs <- lines <$> readProcess "git" ["remote"] rs <- lines <$> readProcess "git" ["remote"]
return $ "origin" `elem` rs return $ "origin" `elem` rs
hasGitRepo :: IO Bool
hasGitRepo = doesFileExist ".git/HEAD"
{- To verify origin branch commit's signature, have to convince gpg {- To verify origin branch commit's signature, have to convince gpg
- to use our keyring. - to use our keyring.
- While running git log. Which has no way to pass options to gpg. - While running git log. Which has no way to pass options to gpg.

View File

@ -31,7 +31,7 @@ import Utility.SafeCommand
-- running the updateServer -- running the updateServer
update :: Maybe HostName -> IO () update :: Maybe HostName -> IO ()
update forhost = do update forhost = do
whenM hasOrigin $ whenM hasGitRep $
req NeedRepoUrl repoUrlMarker setRepoUrl req NeedRepoUrl repoUrlMarker setRepoUrl
makePrivDataDir makePrivDataDir
@ -39,7 +39,7 @@ update forhost = do
req NeedPrivData privDataMarker $ req NeedPrivData privDataMarker $
writeFileProtected privfile writeFileProtected privfile
whenM hasOrigin $ whenM hasGitRepo $
req NeedGitPush gitPushMarker $ \_ -> do req NeedGitPush gitPushMarker $ \_ -> do
hin <- dup stdInput hin <- dup stdInput
hout <- dup stdOutput hout <- dup stdOutput