git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Michele Ballabio <barra_cuda@katamail.com>, git <git@vger.kernel.org>
Subject: Re: git-gui clone WTFery
Date: Wed, 3 Feb 2010 11:52:15 -0800	[thread overview]
Message-ID: <20100203195215.GE14799@spearce.org> (raw)
In-Reply-To: <7vwryuhzsn.fsf@alter.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> wrote:
> Michele Ballabio <barra_cuda@katamail.com> writes:
> > In this case, git-gui is counting objects during a clone; would it be OK
> > to consider "buckets" as synonim of "objects" or "items" or something
> > else?  Then I would translate accordingly.
> 
> A cursory read of the codepath with that message tells me that Shawn is
> calling one [0-9a-f][0-9a-f] directory under .git/objects/ a "bucket" and
> counting the number of them while copying them to implement "git clone"
> inside git-gui (why?---that is a separate issue).

I just had an argument with someone in a private thread about why
commit messages should be more than 30 characters long.  Lets see
if the git-gui history stands up to that and sufficiently explains
why I rewrote clone in Tcl:

  $ git blame lib/choose_repository.tcl
  ...
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  633) 
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  634)           $o_cons start \
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  635)                   [mc "Counting objects"] \
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  636)                   [mc "buckets"]
  ...
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  673)           update
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  674) 
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  675)           file mkdir [file join .git objects pack]
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  676)           foreach i [glob -tails -nocomplain \
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  677)                   -directory [file join $objdir pack] *] {
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  678)                   lappend tolink [file join pack $i]
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  679)           }
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  680)           $o_cons update [incr bcur] $bcnt
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  681)           update
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  682) 
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  683)           foreach i $buckets {
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  684)                   file mkdir [file join .git objects $i]
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  685)                   foreach j [glob -tails -nocomplain \
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  686)                           -directory [file join $objdir $i] *] {
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  687)                           lappend tolink [file join $i $j]
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  688)                   }
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  689)                   $o_cons update [incr bcur] $bcnt
  81d4d3dd (Shawn O. Pearce     2007-09-24 08:40:44 -0400  690)                   update
  ab08b363 (Shawn O. Pearce     2007-09-22 03:47:43 -0400  691)           }


Hmmph. 81d4d3dd and ab08b363 are the relevant commits:

  commit 81d4d3dddc5e96aea45a2623c9b1840491348b92
  Author: Shawn O. Pearce <spearce@spearce.org>
  Date:   Mon Sep 24 08:40:44 2007 -0400

    git-gui: Keep the UI responsive while counting objects in clone
    
    If we are doing a "standard" clone by way of hardlinking the
    objects (or copying them if hardlinks are not available) the
    UI can freeze up for a good few seconds while Tcl scans all
    of the object directories.  This is espeically noticed on a
    Windows system when you are working off network shares and
    need to wait for both the NT overheads and the network.
    
    We now show a progress bar as we count the objects and build
    our list of things to copy.  This keeps the user amused and
    also makes sure we run the Tk event loop often enough that
    the window can still be dragged around the desktop.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

  commit ab08b3630414dfb867825c4a5828438e1c69199d
  Author: Shawn O. Pearce <spearce@spearce.org>
  Date:   Sat Sep 22 03:47:43 2007 -0400

    git-gui: Allow users to choose/create/clone a repository
  ...
    Rather than relying on the git-clone Porcelain that ships with
    git we build the new repository ourselves and then obtain content
    by git-fetch.  This technique simplifies the entire clone process
    to roughly: `git init && git fetch && git pull`.  Today we use
    three passes with git-fetch; the first pass gets us the bulk of
    the objects and the branches, the second pass gets us the tags,
    and the final pass gets us the current value of HEAD to initialize
    the default branch.
    
    If the source repository is on the local disk we try to use a
    hardlink to connect the objects into the new clone as this can
    be many times faster than copying the objects or packing them and
    passing the data through a pipe to index-pack.  Unlike git-clone
    we stick to pure Tcl [file link -hard] operation thus avoiding the
    need to fork a cpio process to setup the hardlinks.  If hardlinks
    do not appear to be supported (e.g. filesystem doesn't allow them or
    we are crossing filesystem boundaries) we use file copying instead.
    
    Signed-off-by: Shawn O. Pearce <spearce@spearce.org>


My guess is, around this time period (Sept. 2007) git-clone was
actually git-clone.sh (Yup, it was built-in in 8434c2f1afed "Build
in clone" Apr 2008).  Clone on Cygwin through git-clone.sh was very
slow compared to clone in Tcl using a native Win32 wish process...

Today with git-clone in C, this is a WTF.  But at the time, it was
a nice performance boost on the Windows platform.  And nobody has
tried to clean this up yet in git-gui.

Yay.  My point about commit messages is still valid.  :-)

-- 
Shawn.

      reply	other threads:[~2010-02-03 19:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 15:16 git-gui translation updates needed Shawn O. Pearce
2010-02-02 10:20 ` [PATCH] git-gui: update Japanese translation Nanako Shiraishi
2010-02-02 12:18 ` [PATCH] git-gui: update french translation Emmanuel Trillaud
2010-02-03  1:09 ` git-gui translation updates needed Junio C Hamano
2010-02-03  1:19   ` gitk translation updates needed? Junio C Hamano
2010-02-03 10:13     ` Michele Ballabio
2010-02-03 19:46       ` Junio C Hamano
2010-02-03 20:56         ` Michele Ballabio
2010-02-03 21:46           ` Paul Mackerras
2010-02-03 22:21             ` Junio C Hamano
2010-02-03 22:20           ` Junio C Hamano
2010-02-03 22:24             ` Junio C Hamano
2010-02-03 10:11   ` git-gui translation updates needed Michele Ballabio
2010-02-03 19:42     ` Junio C Hamano
2010-02-03 19:52       ` Shawn O. Pearce [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100203195215.GE14799@spearce.org \
    --to=spearce@spearce.org \
    --cc=barra_cuda@katamail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).