git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* No error when overwriting ignored files
@ 2021-04-07 19:56 Horst von Brand
  2021-04-07 20:18 ` Jeff King
  2021-04-07 20:47 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Horst von Brand @ 2021-04-07 19:56 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

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. 
-- 
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                    Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria             +56 32 2654239
Casilla 110-V, Valparaiso, Chile 2340000       Fax:  +56 32 2797513

[-- Attachment #2: tstrepos.tgz --]
[-- Type: application/x-gzip, Size: 21878 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No error when overwriting ignored files
  2021-04-07 19:56 No error when overwriting ignored files Horst von Brand
@ 2021-04-07 20:18 ` Jeff King
  2021-04-07 22:17   ` Ævar Arnfjörð Bjarmason
  2021-04-07 20:47 ` Junio C Hamano
  1 sibling, 1 reply; 4+ messages in thread
From: Jeff King @ 2021-04-07 20:18 UTC (permalink / raw)
  To: Horst von Brand; +Cc: git

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.

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No error when overwriting ignored files
  2021-04-07 19:56 No error when overwriting ignored files Horst von Brand
  2021-04-07 20:18 ` Jeff King
@ 2021-04-07 20:47 ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2021-04-07 20:47 UTC (permalink / raw)
  To: Horst von Brand; +Cc: git

Horst von Brand <vonbrand@inf.utfsm.cl> writes:

> When pulling from a repository that tracks a file listed in
> `.gitignore` that would overwrite a local file, this is not
> reported.

Git has the notion of "not to be tracked (i.e. added to the index or
committed) and expendable files", and they are called "ignored"
files.  And ".gitignore" and .git/info/exclude mechanism is used to
mark these paths.

There is no notion of "not to be tracked but precious files" or
mechanism to mark paths as such.  So the behaviour you observed is
fully expected and working as designed.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No error when overwriting ignored files
  2021-04-07 20:18 ` Jeff King
@ 2021-04-07 22:17   ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-04-07 22:17 UTC (permalink / raw)
  To: Jeff King; +Cc: Horst von Brand, git


On Wed, Apr 07 2021, Jeff King wrote:

> 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-07 22:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 19:56 No error when overwriting ignored files Horst von Brand
2021-04-07 20:18 ` Jeff King
2021-04-07 22:17   ` Ævar Arnfjörð Bjarmason
2021-04-07 20:47 ` Junio C Hamano

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git