util: Resolve HEAD in repos that have a remote
JIRA: COMPOSE-3597 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
d01084337e
commit
f1263eeacb
2 changed files with 18 additions and 1 deletions
|
|
@ -61,6 +61,20 @@ class TestGitRefResolver(unittest.TestCase):
|
|||
universal_newlines=True,
|
||||
)
|
||||
|
||||
@mock.patch('pungi.util.run')
|
||||
def test_resolve_ref_with_remote_head(self, run):
|
||||
run.return_value = (
|
||||
0, "CAFEBABE\tHEAD\nBABECAFE\trefs/remotes/origin/HEAD"
|
||||
)
|
||||
|
||||
ref = util.resolve_git_ref("https://git.example.com/repo.git", "HEAD")
|
||||
|
||||
self.assertEqual(ref, "CAFEBABE")
|
||||
run.assert_called_once_with(
|
||||
["git", "ls-remote", "https://git.example.com/repo.git", "HEAD"],
|
||||
universal_newlines=True,
|
||||
)
|
||||
|
||||
@mock.patch('pungi.util.run')
|
||||
def test_resolve_missing_spec(self, run):
|
||||
url = util.resolve_git_url('https://git.example.com/repo.git')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue