All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Palauzov\, Dilyan" <dilyan.palauzov@sit-extern.fraunhofer.de>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: .git/config validations by (for silly errors) by git fsck
Date: Tue, 07 May 2019 01:31:10 +0200	[thread overview]
Message-ID: <875zqni2ip.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <36d37bdd70fba719ecee2c5572a8b85bc9940944.camel@sit-extern.fraunhofer.de>


On Mon, May 06 2019, Palauzov, Dilyan wrote:

> I added manually a remote to .git/config, but updated only the url= line, forgetting to update the fetch= line.  So two
> remotes had
>   fetch = +refs/heads/*:refs/remotes/origin/*
>
> and fetching from the one or the other has overwritten origin/master.  git fsck has not helped.
>
> Please introduce a check in git fcsk that triggers, when two different remotes share the same fetch line, or if the
> fetch line does not reference the remote name.

Pehaps we need a 0bc8d71b99 ("fetch: stop clobbering existing tags
without --force", 2018-08-31) but for remote branches :)

There could be room for something like this in some config-lint tool,
but what you're suggesting is not an error in the general case. There's
many use-cases for having remotes with overlapping or identical fetch
refspecs, e.g. maybe you fetch the "same" repo from two different URLs,
or one is a superset of the other (and can clobber the subset).

When you remove a remote there's even a check for this, we discover if
the refspecs exclusively "belong" to it (and then remove the remote
tracking branches), not if other remotes overlap.

Whether such a check would be viable would be one thing, but it wouldn't
currently belong in git-fsck, its job is to check the object database
for sanity, but perhaps there's cases where it makes sense to expand
that (e.g. shallow/narrow clones where you want a "full" check).

      reply	other threads:[~2019-05-06 23:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 18:19 .git/config validations by (for silly errors) by git fsck Palauzov, Dilyan
2019-05-06 23:31 ` Ævar Arnfjörð Bjarmason [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zqni2ip.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=dilyan.palauzov@sit-extern.fraunhofer.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.