diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-18 15:15:18 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-18 16:21:44 +0100 |
commit | a86bd422641ce083ba0cdb4efe2a4c307eb36f7e (patch) | |
tree | 8aa16fb36f964ba68ad715ed55bb0bc47f6b177a /bitbake | |
parent | c7cadd17ab2f60d0f0560e7eb377675902a7ede0 (diff) | |
download | ast2050-yocto-poky-a86bd422641ce083ba0cdb4efe2a4c307eb36f7e.zip ast2050-yocto-poky-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')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 384007c..af7c623 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py @@ -245,7 +245,22 @@ class Git(FetchMethod): if ud.bareclone: cloneflags += " --mirror" - runfetchcmd("git clone %s %s/ %s" % (cloneflags, ud.clonedir, destdir), d) + # Versions of git prior to 1.7.9.2 have issues where foo.git and foo get confused + # and you end up with some horrible union of the two when you attempt to clone it + # The least invasive workaround seems to be a symlink to the real directory to + # fool git into ignoring any .git version that may also be present. + # + # The issue is fixed in more recent versions of git so we can drop this hack in future + # when that version becomes common enough. + clonedir = ud.clonedir + if not ud.path.endswith(".git"): + indirectiondir = destdir[:-1] + ".indirectionsymlink" + if os.path.exists(indirectiondir): + os.remove(indirectiondir) + os.symlink(ud.clonedir, indirectiondir) + clonedir = indirectiondir + + runfetchcmd("git clone %s %s/ %s" % (cloneflags, clonedir, destdir), d) if not ud.nocheckout: os.chdir(destdir) if subdir != "": |