At first, thanks very much.
Yes, your concern is right. But here i really put a right relative path in the alternates file. Since i can verify it. For example, %> cd /home/jason/source/incremental-bare; %> git tag; %>git branch, all commands work well, while if i put a wrong relative path in the alternates file, those commands will fail.
The weird thing is if i operate git commands in the /home/jason/source/incremental-bare, all commands work well, it can successfully borrow objects (refs) from base-bare via relative path. But if i clone a new project-dir from incremental-bare (use incremental-bare as local machine dir), it will fail, from the failure output it seems it can't borrow objects (refs) from base-bare. But if i add "file://" or "git://" before incremental-bare, it can work successfully. Do you think it is a bug? %> git clone /home/jason/source/incremental-bare project-dir // it will fail %> git clone file:///home/jason/source/incremental-bare project-dir // it will work successfully
To be convenient, i give a reproduce step for this problem:
1. verify git version on my local machine
hwang4@wanghui-desktop:mainline$ git --version
git version 1.7.6
2. basing on linux-2.6, generate a bare repository linux-2.6-bare
hwang4@wanghui-desktop:mainline$ git clone --bare linux-2.6 linux-2.6-bare
Cloning into bare repository linux-2.6-bare...
done.
hwang4@wanghui-desktop:mainline$ du -hms linux-2.6-bare/
950 linux-2.6-bare/
3. make some change in the linux-2.6, and generate a commit
hwang4@wanghui-desktop:mainline$ emacs linux-2.6/Makefile
hwang4@wanghui-desktop:mainline$ cd linux-2.6
hwang4@wanghui-desktop:linux-2.6$ git commit -m "just test" ./Makefile
[master f2c6e4f] just test
1 files changed, 1 insertions(+), 1 deletions(-)
4. let the linux-2.6-bare as a reference, generate a new INCREMENTAL
repositry from linux-2.6
hwang4@wanghui-desktop:mainline$ git clone --bare --reference
./linux-2.6-bare/ file:///home/hwang4/work/mainline/linux-2.6 linux-2.6-inc
Cloning into bare repository linux-2.6-inc...
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
Receiving objects: 100% (3/3), 293 bytes, done.
Resolving deltas: 100% (2/2), completed with 2 local objects.
remote: Total 3 (delta 2), reused 0 (delta 0)
hwang4@wanghui-desktop:mainline$ du -hms linux-2.6-inc/
1 linux-2.6-inc/
{ here i must add "file://" before source repository, otherwise, the mini-tree is full repository instead of incremental, E.G.: hwang4@wanghui-desktop:mainline$ git clone --bare --reference ./linux-2.6-bare/ linux-2.6 linux-2.6-inc Cloning into bare repository linux-2.6-inc... done. hwang4@wanghui-desktop:mainline$ du -hms linux-2.6-inc/ 950 linux-2.6-inc/ }
5. replace the absolute path in the
linux-2.6-inc/objects/info/alternates to the relative path.
hwang4@wanghui-desktop:mainline$ cd linux-2.6-inc/objects/
hwang4@wanghui-desktop:objects$ cat info/alternates
/home/hwang4/work/mainline/linux-2.6-bare/objects
hwang4@wanghui-desktop:objects$ echo ../../linux-2.6-bare/objects/ >
info/alternates
hwang4@wanghui-desktop:objects$ cat info/alternates
../../linux-2.6-bare/objects/
6. verify relative path can work
hwang4@wanghui-desktop:objects$ git tag
v2.6.11
v2.6.11-tree
v2.6.12
v2.6.12-rc2
v2.6.12-rc3
<snip>
7. from the linux-2.6-inc, we clone a new project, if we don't add
"file://", it will fail
hwang4@wanghui-desktop:mainline$ git clone
/home/hwang4/work/mainline/linux-2.6-inc new-project
Cloning into new-project...
done.
error: object directory
/home/hwang4/work/mainline/new-project/.git/objects/../../linux-2.6-bare/objects/
does not exist; check .git/objects/info/alternates.
error: refs/tags/v2.6.38-rc8 does not point to a valid object!
error: refs/tags/v2.6.38-rc7 does not point to a valid object!
<snip>
8. but if we add "file://" before source repository or change to
absolute path in the linux-2.6-inc/objects/info/alternates, i will work
successfully
hwang4@wanghui-desktop:mainline$ git clone
file:///home/hwang4/work/mainline/linux-2.6-inc new-project
Cloning into new-project...
remote: Counting objects: 1970908, done.
remote: Compressing objects: 100% (370377/370377), done.
Receiving objects: 100% (1970908/1970908), 433.54 MiB | 12.60 MiB/s, done.
remote: Total 1970908 (delta 1644814), reused 1908550 (delta 1582482)
Resolving deltas: 100% (1644814/1644814), done.
hwang4@wanghui-desktop:mainline$ ls new-project/
arch COPYING crypto drivers fs init Kbuild kernel MAINTAINERS mm README
samples security tools virt
block CREDITS Documentation firmware include ipc Kconfig lib Makefile
net REPORTING-BUGS scripts sound usr