summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r--bitbake/lib/bb/fetch2/git.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 6175e4c7c9..99230c170a 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -150,7 +150,7 @@ class Git(FetchMethod):
150 return True 150 return True
151 os.chdir(ud.clonedir) 151 os.chdir(ud.clonedir)
152 for name in ud.names: 152 for name in ud.names:
153 if not self._contains_ref(ud.revisions[name], d): 153 if not self._contains_ref(ud.revisions[name], ud.branches[name], d):
154 return True 154 return True
155 if ud.write_tarballs and not os.path.exists(ud.fullmirror): 155 if ud.write_tarballs and not os.path.exists(ud.fullmirror):
156 return True 156 return True
@@ -197,7 +197,7 @@ class Git(FetchMethod):
197 # Update the checkout if needed 197 # Update the checkout if needed
198 needupdate = False 198 needupdate = False
199 for name in ud.names: 199 for name in ud.names:
200 if not self._contains_ref(ud.revisions[name], d): 200 if not self._contains_ref(ud.revisions[name], ud.branches[name], d):
201 needupdate = True 201 needupdate = True
202 if needupdate: 202 if needupdate:
203 try: 203 try:
@@ -281,13 +281,14 @@ class Git(FetchMethod):
281 def supports_srcrev(self): 281 def supports_srcrev(self):
282 return True 282 return True
283 283
284 def _contains_ref(self, tag, d): 284 def _contains_ref(self, tag, branch, d):
285 basecmd = data.getVar("FETCHCMD_git", d, True) or "git" 285 basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
286 cmd = "%s log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % (basecmd, tag) 286 cmd = "%s merge-base --is-ancestorlog %s %s" % (basecmd, tag, branch)
287 output = runfetchcmd(cmd, d, quiet=True) 287 try:
288 if len(output.split()) > 1: 288 output = runfetchcmd(cmd, d, quiet=True)
289 raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output)) 289 except bb.fetch2.FetchError:
290 return output.split()[0] != "0" 290 return False
291 return True
291 292
292 def _revision_key(self, url, ud, d, name): 293 def _revision_key(self, url, ud, d, name):
293 """ 294 """