Commit 2989c2f89ee6bdf43744b5a88ca904afd86b92a3
Fix handling empty repos
Charles Lehner committed on 3/31/2016, 2:17:28 PMParent: a96c983b19a7f8943a1cf0d35d09ababdccb5f2d
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -834,12 +834,15 @@ | ||
834 | 834 | // get branch |
835 | 835 | return path[1] ? |
836 | 836 | serveRepoPage2(req, repo, path) : |
837 | 837 | readNext(function (cb) { |
838 | - repo.getSymRef('HEAD', true, function (err, value) { | |
838 | + // TODO: handle this in pull-git-repo or ssb-git-repo | |
839 | + repo.getSymRef('HEAD', true, function (err, ref) { | |
839 | 840 | if (err) return cb(err) |
840 | - path[1] = value || null | |
841 | - cb(null, serveRepoPage2(req, repo, path)) | |
841 | + repo.resolveRef(ref, function (err, rev) { | |
842 | + path[1] = rev ? ref : null | |
843 | + cb(null, serveRepoPage2(req, repo, path)) | |
844 | + }) | |
842 | 845 | }) |
843 | 846 | }) |
844 | 847 | } |
845 | 848 |
Built with git-ssb-web