git-gui: Allow users to choose/create/clone a repository
commitab08b3630414dfb867825c4a5828438e1c69199d
authorShawn O. Pearce <spearce@spearce.org>
Sat, 22 Sep 2007 07:47:43 +0000 (22 03:47 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 23 Sep 2007 08:57:31 +0000 (23 04:57 -0400)
treeae28f6641d8723d4ff73754a7bc357ff3aa84d65
parenta4bee597134aee9883adba1e79be926a92f80367
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>
git-gui.sh
lib/choose_repository.tcl [new file with mode: 0644]