Commit Graph

1 Commits

Author SHA1 Message Date
Shawn O. Pearce
ab08b36304 git-gui: Allow users to choose/create/clone a repository
If we are started outside of a git repository than it is likely
the user started us from some sort of desktop shortcut icon in
the operating system.  In such a case the user is expecting us to
prompt them to locate the git repository they want to work on,
or to help them make a new repository, or to clone one from an
existing location.  This is a very simple wizard that offers the
user one of these three choices.

When we clone a repository we always use the name `master` in the
local repository, even if the remote side does not appear to point
to that name.  I chose this as a policy decision.  Much of the Git
documentation talks about `master` being the default branch in a
repository and that's what git-init does too.  If the remote side
doesn't call its default branch `master` most users just don't care,
they just want to use Git the way the documentation describes.

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>
2007-09-23 04:57:31 -04:00