diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2008-10-12 22:14:08 +0000 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2008-10-12 22:14:08 +0000 |
commit | 92a448ac98fc22d21170ffdcb8220bffabd9e2da (patch) | |
tree | a3a860ad65d91ac46d42a079ea7f5517e13adc63 /lib/bb/fetch | |
parent | f82988a88c3e1ee8c5b784d1d2d2e41b4df2e3d3 (diff) | |
download | bitbake-92a448ac98fc22d21170ffdcb8220bffabd9e2da.tar.gz |
[git] Do not git-fetch if we already have the rev we want
When not having internet do not fail on a not needed git-fetch
Diffstat (limited to 'lib/bb/fetch')
-rw-r--r-- | lib/bb/fetch/git.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/bb/fetch/git.py b/lib/bb/fetch/git.py index f83e0d580..af16732d3 100644 --- a/lib/bb/fetch/git.py +++ b/lib/bb/fetch/git.py @@ -85,11 +85,12 @@ class Git(Fetch): os.chdir(repodir) # Remove all but the .git directory - runfetchcmd("rm * -Rf", d) - runfetchcmd("git fetch %s://%s%s %s" % (ud.proto, ud.host, ud.path, ud.branch), d) - runfetchcmd("git fetch --tags %s://%s%s" % (ud.proto, ud.host, ud.path), d) - runfetchcmd("git prune-packed", d) - runfetchcmd("git pack-redundant --all | xargs -r rm", d) + if not self._contains_ref(ud.tag, d): + runfetchcmd("rm * -Rf", d) + runfetchcmd("git fetch %s://%s%s %s" % (ud.proto, ud.host, ud.path, ud.branch), d) + runfetchcmd("git fetch --tags %s://%s%s" % (ud.proto, ud.host, ud.path), d) + runfetchcmd("git prune-packed", d) + runfetchcmd("git pack-redundant --all | xargs -r rm", d) os.chdir(repodir) mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) @@ -115,6 +116,10 @@ class Git(Fetch): def suppports_srcrev(self): return True + def _contains_ref(self, tag, d): + output = runfetchcmd("git log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % tag, d, quiet=True) + return output.split()[0] != "0" + def _revision_key(self, url, ud, d): """ Return a unique key for the url |