Commits

Stefan Saasen committed a2dbc90

Minor code cleanup and removing the somewhat arbitrary status messages printed to stdout

Comments (0)

Files changed (4)

src/Git/Remote.hs

                           filterPeeledTags   = not . isSuffixOf "^{}" . C.unpack . ref
                           filterRefs line    = let r = C.unpack $ ref line
                                                    predicates = map ($ r) [isPrefixOf "refs/tags/", isPrefixOf "refs/heads/"]
-                                               in any id predicates
+                                               in or predicates
 
 data Remote = Remote {
     getHost         :: String
         B.writeFile tmpPack packFile
         _ <- runReaderT (createGitRepositoryFromPackfile tmpPack refs) repo
         removeFile tmpPack
-        putStrLn "Checking out HEAD"
-        _ <- runReaderT checkoutHead repo
-        putStrLn "Finished"
+        runReaderT checkoutHead repo
 
 lsRemote' :: Remote -> IO [PacketLine]
 lsRemote' Remote{..} = withSocketsDo $
     withConnection getHost (show $ fromMaybe 9418 getPort) $ \sock -> do
         let payload = refDiscovery getHost getRepository
         send sock payload
-        putStrLn "Receiving..."
         response <- receive sock
         let pack    = parsePacket $ L.fromChunks [response]
-            request = createNegotiationRequest ["multi_ack_detailed", "side-band-64k", "agent=git/1.8.1"] pack ++ flushPkt ++ (pktLine "done\n")
-        putStrLn $ "Sending ref netgotiation request"
+            request = createNegotiationRequest ["multi_ack_detailed",
+                        "side-band-64k",
+                        "agent=git/1.8.1"] pack ++ flushPkt ++ pktLine "done\n"
         send sock request
-        putStrLn "Receiving pack file response"
-        -- FIXME - response might contain more packet lines
         !rawPack <- receiveWithSideband sock (printSideband . C.unpack)
-        -- !rawPack <- receiveFully sock
-        putStrLn "Received pack file"
-        -- return (mapMaybe toRef pack, B.drop 8 rawPack)
         return (mapMaybe toRef pack, rawPack)
     where printSideband str = do
                         hPutStr stderr str

src/Git/Store/Index.hs

               objType Regular           = 8         :: Word32     -- regular file     1000
               objType SymLink           = 10        :: Word32     -- symbolic link    1010
               objType GitLink           = 14        :: Word32     -- gitlink          1110
-              permissions Regular fm    = (fromIntegral fm) :: Word32     -- 0o100755 or 0o100644
+              permissions Regular fm    = fromIntegral fm :: Word32     -- 0o100755 or 0o100644
               permissions _ _           = 0         :: Word32
               !finalPath                = let n     = CS.encode (pathName ++ "\0")
                                               toPad = 8 - ((length n - 2) `mod` 8)

src/Git/Store/ObjectStore.hs

         repo <- ask
         unresolvedObjects <- writeObjects objs
         liftIO $ forM_ unresolvedObjects $ writeDelta repo
-        liftIO $ putStrLn "Done"
     where   writeObjects (x@(PackfileObject (OBJ_REF_DELTA _) _ _):xs) = liftM (x:) (writeObjects xs)
             writeObjects (PackfileObject objType _ content : xs) = do
                 repo <- ask

src/Git/TcpClient.hs

                 Just "NAK\n" -> skip -- ignore here...
                 Just line -> case B.uncons line of
                                 Just (1, rest)  -> recrec (acc `mappend` rest)
-                                Just (2, rest)  -> (f $ "remote: " `C.append` rest) >> skip -- FIXME - scan for linebreaks and prepend "remote: " accordingly (see sideband.c)
+                                Just (2, rest)  -> f ("remote: " `C.append` rest) >> skip -- FIXME - scan for linebreaks and prepend "remote: " accordingly (see sideband.c)
                                 Just (_, rest)  -> fail $ C.unpack rest
                                 Nothing         -> skip
                 Nothing   -> return acc
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.