~edwargix/git.sr.ht

aab7050d8aa55dae8095063b1328a87349080a97 — Drew DeVault 8 years ago 80e830a
Handle empty repositories
2 files changed, 14 insertions(+), 0 deletions(-)

M gitsrht/blueprints/public.py
M scss/main.scss
M gitsrht/blueprints/public.py => gitsrht/blueprints/public.py +4 -0
@@ 35,12 35,16 @@ def cgit_passthrough(user, repo, cgit_path):
    clone_text = "<tr><td colspan='3'>" +\
        "<a rel='vcs-git' href='__CLONE_URL__' title='~{}/{} Git repository'>__CLONE_URL__</a>".format(user, repo) +\
        "</td></tr>"
    if not clone_text in r.text:
        clone_text = clone_text.replace(" colspan='3'", "")
    text = r.text.replace(
        clone_text,
        " ".join(["<tr><td colspan='3'><a href='{}'>{}</a></td></tr>".format(
            url[0].format(base, user, repo), url[-1].format(base, user, repo))
            for url in clone_urls])
    )
    if "Repository seems to be empty" in r.text:
        text = text.replace("<th class='left'>Clone</th>", "<th class='left'>Push</th>")
    return render_template("cgit.html",
            cgit_html=text,
            owner_name="~" + user,

M scss/main.scss => scss/main.scss +10 -0
@@ 58,6 58,16 @@ div#cgit {
    }
  }

  div.error {
    margin-left: 0;
  }

  table.list {
    th:first-child, td:first-child {
      padding-left: 0;
    }
  }

  // Recolor links
  a, table.list td a.ls-dir {
    color: $link-color;