git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: .git/config validations by (for silly errors) by git fsck

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 6, 2019, 23:31 UTC
Message-ID
<875zqni2ip.fsf@evledraar.gmail.com>
In-Reply-To
<36d37bdd70fba719ecee2c5572a8b85bc9940944.camel@sit-extern.fraunhofer.de>
On Mon, May 06 2019, Palauzov, Dilyan wrote:
Show 8 quoted lines
> 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).

Previous: Palauzov, Dilyan
Message 2 of 2 in “.git/config validations by (for silly errors) by git fsck”
  1. Palauzov, DilyanMay 6, 2019
  2. Ævar Arnfjörð BjarmasonMay 6, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.