Re: quick bare clones taking longer?
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:09
David Miller [off-list ref] writes:
From: Junio C Hamano <redacted> Date: Wed, 09 May 2007 14:48:38 -0700quoted
quoted
+ no_checkout=yes + use_separate_remote= + test -z '' + origin=origin ++ get_repo_base ../torvalds/linux-2.6.git + base=This part puzzles me. The only way I could reproduce this was: $ ls -F victim victim.git ls: victim: No such file or directory victim.git: ./ HEAD config description hooks/ lost-found/ refs/ ../ branches/ config~ gitcvs.master.sqlite info/ objects/ remotes/ $ mkdir j $ cd j $ git clone --bare -l -s -n ../victim new.git That is, I did not have ../victim but I did have ../victim.git/ repository, and I gave the former to "git clone". But that suggests that you do not have ../torvalds/linux-2.6.git directory but instead have ../torvalds/linux-2.6.git.git/ which sound a bit insane. Puzzled...This deeply puzzles me too. I'm just not going to go into my git directory using that symlink in my home directory any more. :-)
Ahhh, symlink!
get_repo_base does this:
get_repo_base() {
(cd "$1" && (cd .git ; pwd)) 2> /dev/null
}
and is used like this:
# Turn the source into an absolute path if
# it is local
if base=$(get_repo_base "$repo"); then
repo="$base"
local=yes
fi
That is, get_repo_base does:
* first try to cd to ../torvalds/linux-2.6.git; if it fails
then give up.
* then further cd down to .git if we can but do not worry about
it if we can't. Report where we are and succeed.
If the above "fails", the caller considers the cloned-from
repository a non-local one, and turns off -l -s optimization.
The above sequence is called before we create the new directory
and chdir to it. Maybe pwd has funny behaviour (e.g. $PWD) and
we need to explicitly say /bin/pwd or somesuch...