Automatically initialize a new dumb repository during push
commitc57fa02e55989e8ac11d3ba8c6074019a17d985f
authorShawn O. Pearce <spearce@spearce.org>
Wed, 9 Jul 2008 04:15:30 +0000 (9 00:15 -0400)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 9 Jul 2008 22:57:54 +0000 (10 00:57 +0200)
treeafa1ea6941eca7a368a0e05d454a256e56782500
parent41a9cd96293a85f11b4da02c45d881625212b32a
Automatically initialize a new dumb repository during push

If we are pushing into a repository which has no refs and no packs
we can reasonably assume the repository is brand new.  In such
cases we must ensure there is a valid HEAD and config file in the
repository, otherwise Git clients reading the repository may not
be able to recognize its contents correctly.

By default we try to create HEAD from refs/heads/master, if that
is among the branches being pushed by the user.  This mirrors what
git-init would have initialized HEAD to be.  However if master was
not among the branches pushed then another branch is selected as a
reasonable default.

We initialize .git/config to a very bare configuration, listing
only the repository version.  We avoid setting up core.filemode as
we cannot genrally detect if the remote side understands executable
mode bits.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/transport/WalkPushConnection.java