From: Junio C Hamano <gitster@pobox.com>
To: Sebastian Thiel <sebastian.thiel@icloud.com>
Cc: git@vger.kernel.org, Josh Triplett <josh@joshtriplett.org>,
Kristoffer Haugsbakk <code@khaugsbakk.name>
Subject: Re: [RFC] Define "precious" attribute and support it in `git clean`
Date: Thu, 12 Oct 2023 09:58:19 -0700 [thread overview]
Message-ID: <xmqqttqvg4lw.fsf@gitster.g> (raw)
In-Reply-To: <0E44CB2C-57F2-4075-95BE-60FBFDD3CEE2@icloud.com> (Sebastian Thiel's message of "Thu, 12 Oct 2023 12:55:19 +0200")
Sebastian Thiel <sebastian.thiel@icloud.com> writes:
> ### What about a `$` syntax in `.gitignore` files?
>
> I looked into adding a new prefix, `$` to indicate the following path is
> precious or… valuable. It can be escaped with `\$` just like `\!`.
I have been regretting that I did not make the quoting syntax not
obviously extensible in f87f9497 (git-ls-files: --exclude mechanism
updates., 2005-07-24), which technically was a breaking change (as a
relative pathname that began with '!' were not special, but after
the change, it became necessary to '\'-quote it). A relative
pathname that begins with '$' would be now broken the same way, but
hopefully the fallout would be minor. I presume you picked '$'
exactly because of this reason?
I do not think it will be the end of the world if we don't do so,
but it would be really really nice if we at least explored a way (or
two) to make a big enough hole in the syntax to not just add
"precious", but leave room to later add other traits, without having
to worry about breaking the backward compatibility again. A
simplest and suboptimal way may be to declare that a path that
begins with '$' now needs '\'-quoting (just like your proposal),
reserve '$$' as the precious prefix, and '$' followed by any other
byte reserved for future use, but there may be better ideas.
> *Unfortunately*, users can't just add a local `.git/info/exclude` file with
> `$.config` in it and expect `.config` to be considered precious as the pattern
> search order will search this last as it's part of the exclude-globals.
That it nothing new and is the same for ignored files. The lower
precedence files do not override higher precedence files.
> Thus, to make this work, projects that ship the `.gitignore` files would *have
> to add patterns* that make certain files precious.
Not really. They do not have to do anything if they are content
with the current Git ecosystem. And users who have precious stuff
can mark them in the.git/info/excludes no? The only case that is
problematic is when the project says 'foo' is ignored and expendable
but the user thinks otherwise. So to make this work, projects that
ship the ".gitignore" files have to avoid adding patterns to ignore
things that it may reasonably be expected for its users to mark
precious.
> Such opted-in projects would produce `.gitignore` files like these:
>
> .*
> $.config
I would understand if you ignored "*~" or "*.o", but why ignore ".*"?
THanks.
next prev parent reply other threads:[~2023-10-12 16:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 12:37 [RFC] Define "precious" attribute and support it in `git clean` Sebastian Thiel
2023-10-10 13:38 ` Kristoffer Haugsbakk
2023-10-10 14:10 ` Josh Triplett
2023-10-10 17:07 ` Junio C Hamano
2023-10-12 8:47 ` Josh Triplett
2023-10-10 19:10 ` Kristoffer Haugsbakk
2023-10-12 9:04 ` Josh Triplett
2023-10-10 17:02 ` Junio C Hamano
2023-10-11 10:06 ` Richard Kerry
2023-10-11 22:40 ` Jeff King
2023-10-11 23:35 ` Junio C Hamano
2023-10-12 10:55 ` Sebastian Thiel
2023-10-12 16:58 ` Junio C Hamano [this message]
2023-10-13 9:09 ` Sebastian Thiel
2023-10-13 16:39 ` Junio C Hamano
2023-10-14 7:30 ` Sebastian Thiel
2023-10-13 10:06 ` Phillip Wood
2023-10-14 16:10 ` Junio C Hamano
2023-10-13 11:25 ` Oswald Buddenhagen
2023-10-14 5:59 ` Josh Triplett
2023-10-14 17:41 ` Junio C Hamano
2023-10-15 6:44 ` Elijah Newren
2023-10-15 7:33 ` Sebastian Thiel
2023-10-15 16:31 ` Junio C Hamano
2023-10-16 6:02 ` Sebastian Thiel
2023-10-23 7:15 ` Sebastian Thiel
2023-10-29 6:44 ` Elijah Newren
2023-10-11 21:41 ` Kristoffer Haugsbakk
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=xmqqttqvg4lw.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=josh@joshtriplett.org \
--cc=sebastian.thiel@icloud.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).