Re: [PATCH 2/3] sha1-file: emit error if an alternate looks like a repository
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 5, 2018, 03:35 UTC
- Message-ID
- <xmqqzhtkd4sz.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20181204132716.19208-3-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 8 quoted lines
> Since 26125f6b9b ("detect broken alternates.", 2006-02-22) we've
> emitted an error if the alternates directory doesn't exist, but not
> for the common misstep of adding a path to another git repository as
> an alternate, as opposed to its "objects" directory.
>
> Let's check for this, i.e. whether X/objects or X/.git/objects exists
> if the user supplies X and print an error (which as a commit leading
> up to this one shows doesn't change the exit code, just "warns").I agree that "Let's check for this" is a good idea, but do not necessarily agree with "i.e.". Don't we have a helper that takes the path to an existing directory and answers "Yup, it does look like a Git repository"? Using that is a lot more in line with what you claimed to do in the title for this patch.
I haven't read 3/3 yet, but as I said, I suspect it is reasonable to DWIM and use the object store associated with the directory we found to be a repository.