diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-01-31 14:09:24 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-01 15:08:43 +0000 |
commit | 64662290d3e7deb0b6093b3959c3f3eddb873893 (patch) | |
tree | b68762c324c7d6437ec71be4b2ff5874b18d8a2d /bitbake | |
parent | 38daf8b7eb47915c05aae3edf3125241b5afbe8d (diff) | |
download | poky-64662290d3e7deb0b6093b3959c3f3eddb873893.tar.gz |
fetch2/git: Add workaround for clone using alternates problem
To quote my report of this to the git mailing list:
"""
I have a problem with git clone commands using alternates failing by
mixing up different repositories. I have a situation where I could end
up with both:
/srv/mirrors/repo
/srv/mirrors/repo.git
as bare clones.
I then try cloning "repo" with alternates with the command:
$ git clone -s -n /srv/mirrors/repo /tmp/foo
Cloning into /tmp/foo...
done.
$ cat /tmp/foo/.git/objects/info/alternates
/srv/mirrors/repo.git/objects
Note how I'm now referencing repo.git, not repo. This doesn't work as
expected giving some very bizarre results when actually using the
repository.
I appreciate this is a rather bizarre corner case but its one that is
breaking the build system I work with. Ideally people would use a
consistent URL for the same repository but we have an example where they
haven't and this really shouldn't break like this.
Looking at the code, the cause seems to be
clone.c:get_repo_path():
static char *suffix[] = { "/.git", ".git", "" };
since its looking in order for:
repo/.git (fails)
repo.git (suceeds, incorrect)
repo (never looked at)
I'm not sure what would break if that order were to change, swapping the
last two options.
I can "force" the issue by running:
git clone -s -n /srv/mirrors/repo/ /tmp/foo
but this results in the slightly odd looking:
$ cat /tmp/foo/.git/objects/info/alternates
/srv/mirrors/repo//objects
which does at least work.
"""
This patch adds the trailing slash to ensure the correct repository is
referenced at the expense of some ugliness in the alternates file.
(Bitbake rev: d978e7b35550e3785c7c567ffe4c40a3c3947450)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index d8337149b1..fb0260a42a 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -220,7 +220,7 @@ class Git(FetchMethod): | |||
220 | if os.path.exists(destdir): | 220 | if os.path.exists(destdir): |
221 | bb.utils.prunedir(destdir) | 221 | bb.utils.prunedir(destdir) |
222 | 222 | ||
223 | runfetchcmd("git clone -s -n %s %s" % (ud.clonedir, destdir), d) | 223 | runfetchcmd("git clone -s -n %s/ %s" % (ud.clonedir, destdir), d) |
224 | if not ud.nocheckout: | 224 | if not ud.nocheckout: |
225 | os.chdir(destdir) | 225 | os.chdir(destdir) |
226 | if subdir != "": | 226 | if subdir != "": |