generic-poky/bitbake/lib/bb/fetch2
Richard Purdie 12e5797e51 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>
2012-02-03 17:42:14 +00:00
..
__init__.py fetch2: Improve uri_replace to handle paths with no trailing '/' 2012-01-30 16:16:12 +00:00
bzr.py bitbake/fetch2: Fix the problems introduced by the git fetcher AUTOREV fix 2011-04-20 02:13:26 +01:00
cvs.py fetch, fetch2: Get rid of DeprecationWarning notice 2011-03-03 22:51:33 +00:00
git.py fetch2/git: Add workaround for clone using alternates problem 2012-02-03 17:42:14 +00:00
hg.py Fix mercurial fetcher in fetch2 2011-09-21 14:07:31 +01:00
local.py fetch2/local: Don't default to files in DL_DIR for file:// urls 2012-01-30 16:16:12 +00:00
osc.py Fix more incorrect usages of 'is' 2011-03-31 12:23:23 +01:00
perforce.py fetch, fetch2: Get rid of DeprecationWarning notice 2011-03-03 22:51:33 +00:00
repo.py fetch, fetch2: Get rid of DeprecationWarning notice 2011-03-03 22:51:33 +00:00
ssh.py bitbake/fetch2: Add explict network access exception and handling to give users usable error messages 2011-02-11 22:08:21 +00:00
svk.py fetch, fetch2: Get rid of DeprecationWarning notice 2011-03-03 22:51:33 +00:00
svn.py bitbake/fetch2: Fix the problems introduced by the git fetcher AUTOREV fix 2011-04-20 02:13:26 +01:00
wget.py fetch2/wget: make checkstatus() quieter 2011-09-20 22:24:09 +01:00