summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-18 15:15:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-18 16:21:44 +0100
commita86bd422641ce083ba0cdb4efe2a4c307eb36f7e (patch)
tree8aa16fb36f964ba68ad715ed55bb0bc47f6b177a /bitbake/lib/bb/fetch2/git.py
parentc7cadd17ab2f60d0f0560e7eb377675902a7ede0 (diff)
downloadpoky-a86bd422641ce083ba0cdb4efe2a4c307eb36f7e.tar.gz
bitbake: fetch2/git: Work around git confusion between foo.git and foo repositories
If you have foo and foo.git in GITDIR, the two can end up being confused by git with some horrible union of the two being cloned. This adds a workaround to avoid this happening until git 1.7.9.2 onwards is common enough for this to be removed. We use a symlink to hide the directories we don't want git to know about. (Bitbake rev: bbf1f6fe594c721a296ca09ee7c583d4a205c591) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r--bitbake/lib/bb/fetch2/git.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 384007c81f..af7c623ccb 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -245,7 +245,22 @@ class Git(FetchMethod):
245 if ud.bareclone: 245 if ud.bareclone:
246 cloneflags += " --mirror" 246 cloneflags += " --mirror"
247 247
248 runfetchcmd("git clone %s %s/ %s" % (cloneflags, ud.clonedir, destdir), d) 248 # Versions of git prior to 1.7.9.2 have issues where foo.git and foo get confused
249 # and you end up with some horrible union of the two when you attempt to clone it
250 # The least invasive workaround seems to be a symlink to the real directory to
251 # fool git into ignoring any .git version that may also be present.
252 #
253 # The issue is fixed in more recent versions of git so we can drop this hack in future
254 # when that version becomes common enough.
255 clonedir = ud.clonedir
256 if not ud.path.endswith(".git"):
257 indirectiondir = destdir[:-1] + ".indirectionsymlink"
258 if os.path.exists(indirectiondir):
259 os.remove(indirectiondir)
260 os.symlink(ud.clonedir, indirectiondir)
261 clonedir = indirectiondir
262
263 runfetchcmd("git clone %s %s/ %s" % (cloneflags, clonedir, destdir), d)
249 if not ud.nocheckout: 264 if not ud.nocheckout:
250 os.chdir(destdir) 265 os.chdir(destdir)
251 if subdir != "": 266 if subdir != "":