diff --git a/kas/repos.py b/kas/repos.py index 0958544..1c81d3b 100644 --- a/kas/repos.py +++ b/kas/repos.py @@ -420,7 +420,10 @@ class GitRepo(RepoImpl): '-m', 'msg'] def contains_refspec_cmd(self): - return ['git', 'cat-file', '-t', self.remove_ref_prefix(self.refspec)] + refspec = self.refspec + if refspec and refspec.startswith('refs/'): + refspec = 'remotes/origin/' + self.remove_ref_prefix(refspec) + return ['git', 'cat-file', '-t', refspec] def fetch_cmd(self): cmd = ['git', 'fetch', '-q'] diff --git a/tests/test_refspec.py b/tests/test_refspec.py index f012031..6a42aa8 100644 --- a/tests/test_refspec.py +++ b/tests/test_refspec.py @@ -78,8 +78,8 @@ def test_refspec_absolute(changedir, tmpdir): kas.kas(['shell', 'test3.yml', '-c', 'true']) (rc, output) = run_cmd(['git', 'symbolic-ref', '-q', 'HEAD'], cwd='kas_abs', fail=False, liveupdate=False) - assert rc != 0 - assert output.strip() == '' + assert rc == 0 + assert output.strip() == 'refs/heads/master' (rc, output_kas_abs) = run_cmd(['git', 'rev-parse', 'HEAD'], cwd='kas_abs', fail=False, liveupdate=False) assert rc == 0