init: provide config option for initial branch of push projects
commit86e4e5b9c3a65d2a02dd0ea5a580a1620bd7c6f1
authorKyle J. McKay <mackyle@gmail.com>
Mon, 14 Jun 2021 18:56:03 +0000 (14 11:56 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Mon, 14 Jun 2021 18:56:03 +0000 (14 11:56 -0700)
treed95ad27885756c9b93b49f1e0fb6fd4c619588a2
parent28fb93c9eac0093bcfec41e5fde48c4078565d0a
init: provide config option for initial branch of push projects

Add new $Girocco::Config::initial_branch configuration option that
allows the name of the initial unborn branch in newly created push
projects to be configured.

Make this configuration option work with any Git version.

To provide consistency, if the option is not set, is the empty
string or is invalid, always use the historical name for the initial
unborn branch in a newly created Git repository (i.e. "master").

Even without this support in place, if a different first branch
(other than the unborn branch that `HEAD` points at) gets pushed
to a newly created empty push project, `HEAD` will be automatically
updated to point to that branch.

With this support in place and a different initial branch name set,
one would hope that cloning that initial, empty push project would
automatically configure the initial branch name to match thus making
everything just a tad bit more convenient.

Unfortunately the reality bites.  Git fails to send any capabilities
at all when a project has no refs and the operation is not a push
(in contrast to JGit).  Furthermore, Git will always omit the
symref=HEAD:... capability when the HEAD symbolic-ref is still
unborn.  Additionally, even if a special setup is used that does
send the initial capabilities (like JGit) and does include the
symref=HEAD: capability even when the HEAD symbolic-ref is still
unborn, Git will ignore it when setting up the empty repository
clone!  Major FAIL for Git!

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Girocco/Config.pm
Girocco/Project.pm
Girocco/Validator.pm