git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: leon <leon@kske.dev>
Cc: git@vger.kernel.org
Subject: Re: [Idea] Only allow commits when no undeletable file has been deleted
Date: Fri, 15 Mar 2024 20:41:14 +0000	[thread overview]
Message-ID: <ZfSyakFaxHyTEdxR@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <5f4701bf-3121-4c78-90c8-b1f3a942512b@kske.dev>

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

On 2024-03-15 at 18:55:37, leon wrote:
> Hello,
> 
> I have an idea for a feature I am missing often enough within Git (and it
> **needs** to be part of Git itself as it would be rather useless within
> third-party tools):
> Oftentimes, when you have submodules, you are depending on specific files
> being present within them, i.e. so that your Shell scripts and/or CI tools
> work correctly.
> However, especially when the submodule is under your own control, you
> currently have no option to tell future collaborators that deleting or
> renaming such a file will break things.
> Or even your future self, FWIW.
> So, what if there was a recognized attribute within the `.gitattributes`
> that said `files matching this path spec cannot be deleted`?
> The actual content of the file is irrelevant as long as it exists.
> I don't care how this attribute is called in the end and cannot think of any
> good name.
> My best approach was something like `depended-on-externally` or
> `undeletable`.

I think you want something more than "undeletable".  If I change your
`script/build` file to contain only "Kilroy was here", it's still not
going to work, since that's neither a valid script nor a valid
executable.  I certainly haven't deleted it, but I've rendered it
unusable nonetheless.  This sounds like a contrived example, but it's
entirely possible for people to typo a filename using completion and
save the wrong thing to the wrong file or redirect the output of a
program to the wrong place accidentally.  We've all done it.

I think this is a great place for a CI job, though.  If you know these
files are required, you can add a cheap CI job that simply checks to see
whether the files are valid scripts (or whatever policy you'd like to
have) and fails early on.  You can even make other CI jobs depend on it
so that you don't waste a lot of time failing all the other CI jobs when
their files are missing.

One thing I've also seen that we have at work is that you can link CI
jobs for project A to project B.  Thus, if project B is a dependency of
project A, changes to project B run its own CI jobs plus a standard
project A CI job, to verify that nothing's broken.  This is really
useful and a great way to avoid breaking things in more subtle ways
(e.g., removing a function that you didn't think you needed, but project
A does, or changing the behaviour of a function in a way that breaks
other projects).
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

      reply	other threads:[~2024-03-15 20:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 18:55 [Idea] Only allow commits when no undeletable file has been deleted leon
2024-03-15 20:41 ` brian m. carlson [this message]

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=ZfSyakFaxHyTEdxR@tapette.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=leon@kske.dev \
    /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).