diff options
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 7 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 3a4ae6df45..5f4ec6128c 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -730,7 +730,12 @@ class Git(FetchMethod): | |||
730 | output = runfetchcmd("%s rev-list -n 1 %s" % (ud.basecmd, ud.parm['tag']), d, workdir=destdir) | 730 | output = runfetchcmd("%s rev-list -n 1 %s" % (ud.basecmd, ud.parm['tag']), d, workdir=destdir) |
731 | output = output.strip() | 731 | output = output.strip() |
732 | if output != ud.revision: | 732 | if output != ud.revision: |
733 | raise bb.fetch2.FetchError("The revision the git tag '%s' resolved to didn't match the SRCREV in use (%s vs %s)" % (ud.parm['tag'], output, ud.revision), ud.url) | 733 | # It is possible ud.revision is the revision on an annotated tag which won't match the output of rev-list |
734 | # If it resolves to the same thing there isn't a problem. | ||
735 | output2 = runfetchcmd("%s rev-list -n 1 %s" % (ud.basecmd, ud.revision), d, workdir=destdir) | ||
736 | output2 = output2.strip() | ||
737 | if output != output2: | ||
738 | raise bb.fetch2.FetchError("The revision the git tag '%s' resolved to didn't match the SRCREV in use (%s vs %s)" % (ud.parm['tag'], output, ud.revision), ud.url) | ||
734 | 739 | ||
735 | repourl = self._get_repo_url(ud) | 740 | repourl = self._get_repo_url(ud) |
736 | runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=destdir) | 741 | runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=destdir) |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 65339d1bb1..4b5439f525 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -3139,6 +3139,13 @@ class GitTagVerificationTests(FetcherTest): | |||
3139 | fetcher.download() | 3139 | fetcher.download() |
3140 | fetcher.unpack(self.unpackdir) | 3140 | fetcher.unpack(self.unpackdir) |
3141 | 3141 | ||
3142 | def test_annotated_tag_rev_match(self): | ||
3143 | # Test a url with rev= and tag= set works | ||
3144 | # rev is the annotated tag revision in this case | ||
3145 | fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.8;protocol=https;rev=6d363159e4b7dc566fc40d069b2615e61774a7d8;tag=2.8.7"], self.d) | ||
3146 | fetcher.download() | ||
3147 | fetcher.unpack(self.unpackdir) | ||
3148 | |||
3142 | @skipIfNoNetwork() | 3149 | @skipIfNoNetwork() |
3143 | def test_tag_rev_match2(self): | 3150 | def test_tag_rev_match2(self): |
3144 | # Test a url with SRCREV and tag= set works | 3151 | # Test a url with SRCREV and tag= set works |