Subject: Re: [PATCH v6 17/19] fsck: Introduce `git fsck --quick`

From: Michael Haggerty <[email-masked]>
Date: Sun, 21 Jun 2015 06:55:38 +0200

On 06/19/2015 10:53 PM, Junio C Hamano wrote:
> Johannes Schindelin <[email-masked]> writes:
> 
>> Can you think of a name for the option that is as short as `--quick`
>> but means the same as `--connectivity-only`?
> 
> No I can't.  I think `--connectivity-only` is a very good name that
> is unfortunately a mouthful, I agree that we need a name that is as
> short as `--xxxxx` that means the same as `--connectivity-only`.  I
> do not think `--quick` is that word; it does not mean such a thing.

`--connectivity-only` says that "of all the things that fsck can do,
skip everything except for the connectivity check". But the switch
really affects not the connectivity part of the checks (that part is
done in either case), but the blob part. So, if we ignore the length of
the option name for a moment, it seems like the options should be
something like `--check-blob-integrity`/`--no-check-blob-integrity`. The
default would remain `--check-blob-integrity` of course, but

* Someday there might be a config setting that people can use to change
the default behavior of fsck to `--no-check-blob-integrity`.
* Someday there might be other expensive types of checks [1] that we
want to turn on/off independent of blob integrity checks.

But now that I'm writing this, a silly question occurs to me: Do we need
an overall option like this at all? If I demote all blob-integrity
checks to "ignore" via the mechanism that you have added, then shouldn't
fsck automatically detect that it doesn't have to open the blobs at all
and enable this speedup automatically? So maybe
`--(no-)?check-blob-integrity` is actually a shorthand for turning a few
more specific checks on/off at once.

As for thinking of a shorter name for the option: assuming the blob
integrity checks can be turned on and off independently as described
above, then I think it is reasonable to *also* add a `--quick` option
defined as

--quick: Skip some expensive checks, dramatically reducing the
    runtime of `git fsck`. Currently this is equivalent to
    `--no-check-blob-integrity`.

In the future if we invent other expensive checks we might also add them
to the list of things that are skipped by `--quick`.

Michael

[1] For example, if LFS or something like it every became part of
standard Git, one could imagine a super-expensive
`--check-lfs-object-availability` check that would would default to OFF
but sometimes turn on by hand.

-- 
Michael Haggerty
[email-masked]