Return an error when trying to clone a project

-- >8 --
nabijaczleweli@tarta:~/uwu/git$ strace -f -o ss git clone
Cloning into 'projeq'...
fatal: remote error:

This is a sourcehat project, which amalgamates multiple source repositories,
issue trackers, and mailing lists.

You can visit
to pick a specific source.

-- >8 --

Returning a non-ERR here and going down to a pack is possible
but errors later down the line are either more verbose and hint at
implementation errors, or leave repositories in a sticky state.

Ref: ~sircmpwn/
master 0.9.3
наб 3 years ago committed by Drew DeVault
parent 4d009f9c9a
commit b2f59c803b

@ -1,6 +1,6 @@
import re
from sqlalchemy import or_
from flask import Blueprint, render_template, request, redirect, url_for
from flask import Blueprint, Response, render_template, request, redirect, url_for, abort
from flask import session
from hubsrht.decorators import adminrequired
from hubsrht.projects import ProjectAccess, get_project
@ -8,13 +8,31 @@ from import git, hg
from hubsrht.types import Feature, Event, EventType
from hubsrht.types import Project, RepoType, Visibility
from hubsrht.types import SourceRepo, MailingList, Tracker
from srht.config import cfg, get_origin
from srht.database import db
from srht.flask import paginate_query
from srht.flask import csrf_bypass, paginate_query
from srht.oauth import current_user, loginrequired
from srht.validation import Validation, valid_url
projects = Blueprint("projects", __name__)
site_name = cfg("", "site-name")
ext_origin = get_origin("", external=True)
clone_message = lambda owner, project: f"""
You have tried to clone a project from {site_name}, but you probably meant to
clone a specific git repository for this project instead. A single project on
{site_name} often has more than one git repository.
You can visit the following URL:
To the browse source repositories for this project.
def summary_GET(owner, project_name):
owner, project = get_project(owner, project_name,
@ -52,6 +70,19 @@ def summary_GET(owner, project_name):
summary=summary, summary_error=summary_error,
events=events, EventType=EventType)
def summary_refs(owner, project_name):
if request.args.get("service") == "git-upload-pack":
owner, project = get_project(owner, project_name,
msg = clone_message(owner, project)
return Response(f"""001e# service=git-upload-pack
000000400000000000000000000000000000000000000000 HEAD\0agent=hubsrht
{'{:04x}'.format(4 + 3 + 1 + len(msg))}ERR {msg}0000""",
def feed_GET(owner, project_name):
owner, project = get_project(owner, project_name,