generic-poky/bitbake/lib/bb
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
..
fetch bitbake: Sync fetch back with upstream 2011-05-06 18:18:59 +01:00
fetch2 fetch2/git: Add workaround for clone using alternates problem 2012-02-03 17:42:14 +00:00
parse parse_py: Use absolute paths for FILE 2012-01-30 16:16:11 +00:00
pysh make exception handling syntax consistent 2011-06-15 11:13:13 +01:00
server bitbake/process.py: Ensure queued UI events are queued right before we add our own handler 2011-07-07 10:57:43 +01:00
ui ui/crumbs/hobprefs: trigger a reparse after changing IMAGE_FSTYPES 2012-01-30 16:16:13 +00:00
COW.py Apply some 2to3 refactorings 2010-07-02 15:41:37 +01:00
__init__.py bitbake/logging: Overhaul internal logging process 2011-08-15 09:14:28 +01:00
build.py build.py: Be determistic about a function's cwd 2012-01-30 16:16:13 +00:00
cache.py bb/cache: rename confusing variable 2011-08-11 19:07:59 +01:00
cache_extra.py Introduce extra cache class for image creator 2011-06-07 22:39:12 +01:00
codeparser.py codeparser: silence non-literal warnings for vardeps 2012-01-30 16:16:13 +00:00
command.py bb/command|cooker: refactor the reparseFiles logic 2011-08-12 21:06:59 +01:00
compat.py bitbake: Add missing file 2011-05-07 08:49:28 +01:00
cooker.py cooker.py: Allow the -e option to work with virtual classes and -b 2012-01-30 16:16:13 +00:00
daemonize.py Apply some 2to3 transforms that don't cause issues in 2.6 2010-07-02 15:41:33 +01:00
data.py codeparser: silence non-literal warnings for vardeps 2012-01-30 16:16:13 +00:00
data_smart.py codeparser: silence non-literal warnings for vardeps 2012-01-30 16:16:13 +00:00
event.py bitbake/event: Allow event handlers to quietly raise SkipPackage events 2011-09-02 18:15:27 +01:00
exceptions.py bb.exceptions: don't choke on frames without arguments 2011-06-08 20:38:25 +01:00
methodpool.py Consolidate the exec/eval bits, switch anonfunc to better_exec, etc 2010-07-02 15:41:31 +01:00
msg.py bitbake/lib/bb/msg.py: fix setting debug and verbosity levels 2011-09-26 19:35:58 +01:00
namedtuple_with_abc.py bb.namedtuple_with_abc: add useful util from activestate 2011-06-08 20:38:23 +01:00
persist_data.py bitbake/persist_data: Sync file with upstream bitbake 2011-05-06 18:07:23 +01:00
process.py make exception handling syntax consistent 2011-06-15 11:13:13 +01:00
providers.py lib/bb/providers: make "checking PREFERRED_PROVIDER_%s" a debug message 2011-08-15 09:13:53 +01:00
runqueue.py runqueue.py: Fix debug message to reference the correct task 2012-01-30 16:16:12 +00:00
shell.py Introduce new param caches_array into Cache impl. 2011-06-07 22:39:52 +01:00
siggen.py siggen.py: If both sigs have a variable in it's whitelist then don't say it's changed 2012-01-30 16:16:13 +00:00
taskdata.py taskdata: fix string formatting of an error message 2011-09-20 22:22:21 +01:00
utils.py Nothing uses USERNAME, remove it - can cause sstate-cache conflicts 2012-01-30 16:16:13 +00:00