config: we're so precious
commitf63d2806a0b5c1fbe77f3731c2b384fb6778cea0
authorKyle J. McKay <mackyle@gmail.com>
Sat, 23 Dec 2017 03:09:59 +0000 (22 19:09 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Sat, 23 Dec 2017 03:09:59 +0000 (22 19:09 -0800)
treec3ce04ac99e510aec9bfa805d860a51964d5f2eb
parentfd1aff907f596aaea7686d05f9f809bd04e764ee
config: we're so precious

Make sure extensions.preciousObjects is set to true in each
repository's config file.

Since Git v2.6.3, Git understands a new repositoryFormat version
of 1.  It also understands a new extensions.preciousObjects config
item.

Set extensions.preciousObjects to true on project creation and
when running update-all-config, but leave repositoryformatversion
set to 0 (or 1 if it was later manually changed to 1).

This way when running Git v2.6.3 or later extensions.preciousObjects
will take effect but by leaving core.repositoryformatversion alone
earlier versions of Git will still work too (they will just ignore
the extensions.preciousObjects setting).

When running Git version 2.6.3 or later this gets us protection
against using the "-d" option with "git repack" and prevents running
"git prune" at all.  Additionally the "git gc" command will simply
skip running any repack or prune operations itself.

Now that we have gc the new order, we run neither "git repack" nor
do we run "git prune".  Therefore setting "extensions.preciousObjects=true"
does not affect Girocco itself but does provide Girocco with some
protection from overly ambitious administrators or users of linked
working trees.

While it's certainly possible for a determined user to get around
these protections, this should go a long way towards preventing the
accidental premature loss of any "recently reachable" objects.

Also since the projtool.pl "gc" command provides ready access to
running Girocco's version of gc on a project there's very little
downside to making this change, but plenty of upside.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Girocco/Project.pm
toolbox/update-all-config.pl