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

Re: No error when overwriting ignored files

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 7, 2021, 22:17 UTC
Message-ID
<87a6q9kacx.fsf@evledraar.gmail.com>
In-Reply-To
<YG4Tl1IPlFBIhV4l@coredump.intra.peff.net>
On Wed, Apr 07 2021, Jeff King wrote:
Show 20 quoted lines
> On Wed, Apr 07, 2021 at 03:56:38PM -0400, Horst von Brand wrote:
>
>> When pulling from a repository that tracks a file listed in
>> `.gitignore` that would overwrite a local file, this is not reported.
>> 
>> For example, in the attached repositories, when doing `git pull tst1`
>> in `tst2`, it is (correctly) reported that `ignored.not` would be
>> overwritten, while `ignored.txt` is not reported.
>
> This is behaving as intended. Ignored files are not considered
> "precious". You can find more discussion by searching for that term in
> the list archive.
>
> There is no concept of "ignored but precious" in Git. However, here's an
> old patch series that tries to move in that direction (using an
> attribute):
>
>   https://lore.kernel.org/git/20190216114938.18843-1-pclouds@gmail.com/
>
> AFAIK nobody is actively working on it right now.

Having re-read that thread now I still think by far the most useful way forward with this for anyone who's interested is to investigate/add missing tests for our current behavior, why/when it got introduced, whether anyone wanted it or if it was emergent etc. See [1] for a summary.

That's quite a bit of work, but is work that someone with little/no previous familiarity with git's development should be able to do with enough time & motivation....

1. https://lore.kernel.org/git/87ftsi68ke.fsf@evledraar.gmail.com/
Previous: Jeff KingNext: Junio C Hamano
Message 3 of 4 in “No error when overwriting ignored files”
  1. Horst von BrandApr 7, 2021
  2. Jeff KingApr 7, 2021
  3. Ævar Arnfjörð BjarmasonApr 7, 2021
  4. Junio C HamanoApr 7, 2021

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.