Commit Graph

17 Commits

Author SHA1 Message Date
Chenxiong Qi
b577b0f9e1 Refactor SCM.get_latest
git-ls-remote accepts paramter refs to just return refs for specific
ones. This refactor uses this parameter to avoid handling full list of
refs from remote repository.

In original code, option --exit-code is passed to git-ls-remote, which
would cause command return exit code 2 when no ref is found from remote
repository. SCM._run raises an error if that happens, but the raised
error is not handled. This refactor catches this error to ensure the
original behavior happens, that is if a ref is not found, treat it as a
commit hash and call SCM.get_full_commit_hash.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2018-11-07 11:02:40 +08:00
Filip Valder
598347e1b6 Import module API 2018-09-07 17:12:01 +02:00
Yash Nanavati
ed25afd9ec Code changes for Python 3 support 2018-03-04 03:22:38 -05:00
mprahl
b7998d4402 Remove the need for nose and solely rely on pytest 2018-02-05 22:11:31 -05:00
mprahl
e91d09f7ca Change the format of the unit tests to pytest 2018-01-31 16:34:21 -05:00
Ralph Bean
1e140a6615 s/incorect/incorrect/ 2018-01-15 12:52:59 -05:00
mprahl
df5b9ab04a Ignore entries in "git ls-remote" with "refs/remotes/origin/" 2017-11-17 11:35:35 -05:00
mprahl
1622494b17 Replace the name of the "branch" parameter in "scm.get_latest" to "ref" 2017-11-13 09:20:20 -05:00
Martin Curlej
bf2369e8e0 Fixed issue with getting the latest ref
Signed-off-by: Martin Curlej <mcurlej@redhat.com>
2017-11-09 12:47:08 +01:00
mprahl
e91f4fdea6 Revert "added git option which will return correct return code"
This caused an issue when the modulemd had the ref's for its components
as commit hashes instead of branches.

This reverts commit 15f332e60f.
2017-11-03 16:20:33 -04:00
Martin Curlej
15f332e60f added git option which will return correct return code
added tests

fixing typo
2017-10-04 11:44:24 +02:00
Filip Valder
09b3f32dbb Fix #619: Support for module YAML file validation within a SCM repository 2017-08-07 13:10:53 +02:00
Filip Valder
a192dab1e2 return Unprocessable Entity in case of a commit hash which is not found within the repository 2017-04-10 16:41:24 +02:00
Jan Kaluza
4b3e295e48 Expect 'branch' while handling submission of module and use it to set the stream of module. Also verify that the commit hash belongs to that branch. 2017-03-07 11:25:06 +01:00
Ralph Bean
357b4a089d Add an internal repo for tests. 2017-02-20 21:07:20 -05:00
Ralph Bean
0ffb1f7e42 Test that we can clone repos with a trailing slash. 2017-02-20 12:44:49 -05:00
Ralph Bean
2e6e153660 Add a few tests for the SCM module.
In particular, test to see if we can pass a branch name with shell
characters, and get MBS to inadvertently execute malicious code.

The test shows that doing this in a straightforward way is not possible
and should guard against any future regressions.

Fixes #329.
2017-02-20 09:25:00 -05:00