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

Re: problem with not being able to enforce git content filters

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Oct 16, 2018, 23:26 UTC
Message-ID
<20181016232636.GF432229@genre.crustytoothpaste.net>
In-Reply-To
<5d4966c8-8171-9a0a-5120-f7c151c2b81f@stason.org>
On Tue, Oct 16, 2018 at 01:36:37PM -0700, Stas Bekman wrote:
Show 26 quoted lines
> The problem is that it can't be enforced.
> 
> When it's not enforced, we end up with some devs using it and others
> don't, or more often is the same dev sometimes doesn't have it configured.
> 
> When a person has a stripped out notebook checked out, when another
> person commits un-stripped out notebook, it leads to: invalid `git
> status` reports, `git pull` breaks, `git stash` doesn't work, since it
> tries to stash using the filters, and `git pull' can never succeed
> because it thinks that it'll overwrite the local changes, but `git diff`
> returns no changes.
> 
> So the only solution when this happens is to disable the filters, clean
> up the mess, re-enable the filters. Many people just make a new clone -
> ouch!
> 
> And the biggest problem is that it affects all users who may have the
> filters enabled, e.g. because they worked on a PR, and not just devs -
> i.e. the repercussions are much bigger than just a few devs affected.
> 
> We can't use server-side hooks to enforce this because the project is on
> github.
> 
> And the devs honestly try to do their best to remember to configure the
> filters, but for some reason they disappear for them, don't ask me why,
> I don't know. This is an open source project team, not a work place.

This sounds like it could be easily solved by continuous integration. You could set up a job on any of a variety of services that checks that a pull request or other commit is clean when when the filter runs. If it doesn't pass, the code doesn't merge.

This is what other projects do for style-related and tidiness issues. Similar approaches can be used in other situations to enforce that all line endings are LF, or whatever your project desires.

I don't think it's a good idea to provide Git configuration to end users, even with prompting, since there are many novice users who don't know what the security implications of various config options are. I also personally never would want to be prompted for such a thing, so even if that were a feature, people would turn if off, and you'd be no better off than you were before.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Stas BekmanNext: Stas Bekman
Message 4 of 7 in “problem with not being able to enforce git content filters”
  1. Stas BekmanOct 16, 2018
  2. Ævar Arnfjörð BjarmasonOct 16, 2018
  3. Stas BekmanOct 16, 2018
  4. brian m. carlsonOct 16, 2018
  5. Stas BekmanOct 16, 2018
  6. brian m. carlsonOct 17, 2018
  7. Stas BekmanOct 17, 2018

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.