mirror of
https://code.sup39.dev/repos/Wqawg
synced 2025-01-15 17:15:09 +09:00
If Git repo is empty (no branches), don't 404, just show basic repo page
This commit is contained in:
parent
0be7f05d31
commit
339c2253f9
1 changed files with 24 additions and 23 deletions
|
@ -119,29 +119,30 @@ loadSourceView git refT dir = do
|
||||||
tags <- G.tagList git
|
tags <- G.tagList git
|
||||||
let refS = T.unpack refT
|
let refS = T.unpack refT
|
||||||
refN = RefName refS
|
refN = RefName refS
|
||||||
msv <- if refN `S.member` branches || refN `S.member` tags
|
msv <-
|
||||||
then do
|
if null branches
|
||||||
tipOid <- resolveName git refS
|
then return $ Just $ SourceDir $ DirectoryView Nothing [] Nothing
|
||||||
mtree <- G.resolveTreeish git $ unObjId tipOid
|
else if refN `S.member` branches || refN `S.member` tags
|
||||||
case mtree of
|
then do
|
||||||
Nothing -> return Nothing
|
tipOid <- resolveName git refS
|
||||||
Just tree -> do
|
mtree <- G.resolveTreeish git $ unObjId tipOid
|
||||||
let dir' = map (G.entName . encodeUtf8) dir
|
for mtree $ \ tree -> do
|
||||||
view <- viewPath git tree dir'
|
let dir' = map (G.entName . encodeUtf8) dir
|
||||||
Just <$> case view of
|
view <- viewPath git tree dir'
|
||||||
RootView rows -> do
|
case view of
|
||||||
mreadme <- findReadme git rows
|
RootView rows -> do
|
||||||
let ents = map rowToEntry rows
|
mreadme <- findReadme git rows
|
||||||
return $ SourceDir $
|
let ents = map rowToEntry rows
|
||||||
DirectoryView Nothing ents mreadme
|
return $ SourceDir $
|
||||||
TreeView name _ rows -> do
|
DirectoryView Nothing ents mreadme
|
||||||
mreadme <- findReadme git rows
|
TreeView name _ rows -> do
|
||||||
let ents = map rowToEntry rows
|
mreadme <- findReadme git rows
|
||||||
return $ SourceDir $
|
let ents = map rowToEntry rows
|
||||||
DirectoryView (Just name) ents mreadme
|
return $ SourceDir $
|
||||||
BlobView name _ body ->
|
DirectoryView (Just name) ents mreadme
|
||||||
return $ SourceFile $ FileView name body
|
BlobView name _ body ->
|
||||||
else return Nothing
|
return $ SourceFile $ FileView name body
|
||||||
|
else return Nothing
|
||||||
return (branches, tags, msv)
|
return (branches, tags, msv)
|
||||||
|
|
||||||
readSourceView
|
readSourceView
|
||||||
|
|
Loading…
Reference in a new issue