git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: quick bare clones taking longer?

From
Junio C Hamano <junkio@cox.net>
Date
May 9, 2007, 22:59 UTC
Message-ID
<7v3b25siwk.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070509.150256.59469756.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
Show 34 quoted lines
> From: Junio C Hamano <junkio@cox.net>
> Date: Wed, 09 May 2007 14:48:38 -0700
>
>> > + 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...

Previous: David MillerNext: David Miller
Message 7 of 24 in “quick bare clones taking longer?”
  1. David MillerMay 9, 2007
  2. Johannes SchindelinMay 9, 2007
  3. Junio C HamanoMay 9, 2007
  4. David MillerMay 9, 2007
  5. Junio C HamanoMay 9, 2007
  6. David MillerMay 9, 2007
  7. Junio C HamanoMay 9, 2007
  8. David MillerMay 9, 2007
  9. Junio C HamanoMay 9, 2007
  10. Junio C HamanoMay 10, 2007
  11. Junio C HamanoMay 10, 2007
  12. David MillerMay 10, 2007
  13. Matthieu MoyMay 10, 2007
  14. Junio C HamanoMay 10, 2007
  15. Matthieu MoyMay 10, 2007
  16. Brian GernhardtMay 10, 2007
  17. Win32 version, was Re: quick bare clones taking longer?Johannes Schindelin, May 12, 2007
  18. Brian GernhardtMay 12, 2007
  19. Johannes SixtMay 10, 2007
  20. Dan NicholsonMay 10, 2007
  21. Junio C HamanoMay 10, 2007
  22. Dan NicholsonMay 10, 2007
  23. Junio C HamanoMay 10, 2007
  24. Andy WhitcroftMay 10, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.