git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elijah Newren <newren@gmail.com>
To: phillip.wood@dunelm.org.uk
Cc: Junio C Hamano <gitster@pobox.com>,
	Sebastian Thiel <sebastian.thiel@icloud.com>,
	 Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org,  Josh Triplett <josh@joshtriplett.org>
Subject: Re: [PATCH] precious-files.txt: new document proposing new precious file type
Date: Tue, 23 Jan 2024 22:50:48 -0800	[thread overview]
Message-ID: <CABPp-BE1D+ap_0bw-U9353+7hTU4Ybo_BUDQ94wpASkpAcgyRw@mail.gmail.com> (raw)
In-Reply-To: <7fc35078-a165-4b3c-96e2-37fbe55e109d@gmail.com>

Hi Phillip,

On Fri, Jan 19, 2024 at 8:53 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
[...]
> >>   * Which one between "'git add .' adds '.config' that users did not
> >>     want to add" and "'git clean -f' removes '.config' together with
> >>     other files" a larger problem to the users, who participate in a
> >>     project that already decided to use the new .gitignore feature to
> >>     mark ".config" as "precious", of older versions of Git that
> >>     predate "precious"?
> >
> > Accidental "git add ." comes with 3 opportunities to correct the
> > problem before it becomes permanent: before commiting, after
> > committing but before pushing, and after publishing for patch review
> > (where it can even be caught by third parties) but before the
> > patch/PR/MR is accepted and included.  At each stage there's a chance
> > to go back and correct the problem.
>
> If you've added a secret then catching it after you've published the
> patch for review is likely to be too late. I agree there are a couple of
> chances to catch it before that though.

Ah, good point.

> > Accidental nuking of a file (via either git clean or git checkout or
> > git merge or whatever), cannot be reviewed or corrected; it's
> > immediately too late.
>
> Indeed, though "git clean" requires the user to pass a flag before it
> will delete anything does have a dry-run mode to check what's going to
> happen so there is an opportunity for users to avoid accidental deletions.

Yes, good point again for "git clean"; it does have one level of check
before the operation users can take advantage of.  The same cannot be
said for the files nuked by checkout/merge/rebase/cherry-pick, though.

> > [...]
> > However, on a closely related note, in my response to Sebastian I
> > point out that the '$' syntax permits individual teams to prioritize
> > avoiding either accidental deletions or accidental adds on a filename
> > or glob granularity, so if folks are concerned with handling by older
> > Git versions or are just extra concerned with certain files, they can
> > optimize accordingly.
>
> That is an advantage. I do worry that the '$' syntax is unintuitive and
> will further add to the impression that git is hard to use. I think the
> choice comes down how much we are worried about the way older versions
> of git treat ".gitignore" files with the new syntax.

Interesting, I thought the mixture of '!' as a prefix and '#(keep)' as
a previous-line directive would be somewhat inconsistent and add
further to the impression that git is hard to use, though I can also
see your point that '$' as a prefix can as well.

> While I can see it would be helpful to settle the syntax question I
> think parsing the new syntax is a relatively small part of the work that
> needs to be done to implement precious files.

Oh, I agree it's a small part of the work, but as stated previously,
I'm not doing that work (Sebastian is).  I'm just trying to help avoid
getting unintended consequences in the design, and to me this is an
important edge case to consider, get an agreement on, and document in
some fashion.

Anyway, Junio seems to have weighed in with a tentative path forward,
and everyone has been very good about bringing up additional
considerations around this issue that are worth documenting in the
design document, so I'll try to put together an update soon-ish.

  parent reply	other threads:[~2024-01-24  6:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27  2:25 [PATCH] precious-files.txt: new document proposing new precious file type Elijah Newren via GitGitGadget
2023-12-27  5:28 ` Junio C Hamano
2023-12-27  6:54   ` Elijah Newren
2023-12-27 22:15     ` Junio C Hamano
2024-01-18  7:51       ` Sebastian Thiel
2024-01-18 19:14         ` Junio C Hamano
2024-01-18 21:33           ` Sebastian Thiel
2024-01-19  2:37             ` Elijah Newren
2024-01-19  7:51               ` Sebastian Thiel
2024-01-19 18:45                 ` Junio C Hamano
2024-01-19  2:58           ` Elijah Newren
2024-01-19 16:53             ` Phillip Wood
2024-01-19 17:17               ` Junio C Hamano
2024-01-24  6:50               ` Elijah Newren [this message]
2024-02-11 22:08   ` Sebastian Thiel

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=CABPp-BE1D+ap_0bw-U9353+7hTU4Ybo_BUDQ94wpASkpAcgyRw@mail.gmail.com \
    --to=newren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=josh@joshtriplett.org \
    --cc=phillip.wood@dunelm.org.uk \
    --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).