gitweb: Allow to import from a remote repository

- Allow to enter either name or URL when creating repository

- Validate a repository URL, allow only http and https schemes

- Set autocomplete off on the name/URL field because URL may contain
  username:password

- Check whether the repository actually exists before cloning

- Show progress info while cloning

- Actions script: new subcommand check-repo-exists and new arguments
  for the create-repo: --url, --prepare-only and --skip-prepare

- Add test for invalid URLs

Closes #1670

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Fix validating repo name in edit form]
[sunil: Don't pipe stdin of clone process, it may lead to a hang]
[sunil: Always run clone process with 'C' locale since we are parsing output]
[sunil: Cosmetic changes]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa authored and Sunil Mohan Adapa committed 2019-11-04 21:16:30 -08:00
1 parent ca0c991562
commit c99b33b40e
6 files changed
+378 -88

No files matched your search

@@ -104,3 +104,16 @@ def test_action_create_repo_with_invalid_names(call_action, name):
'create-repo', '--name', name, '--description', '', '--owner', '',
'--keep-ownership'
])
@pytest.mark.parametrize('url', [
'Test-repo', 'file://root/Test-repo', 'localhost/Test-repo',
'ssh://localhost/Test-repo', 'https://localhost/.Test-repo'
])
def test_action_create_repo_with_invalid_urls(call_action, url):
"""Test that cloning repository with invalid URL fails."""
with pytest.raises(ValidationError):
call_action([
'create-repo', '--url', url, '--description', '', '--owner', '',
'--keep-ownership'
])