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

Re: Please consider extending .gitignore to support setting of a file size limit

From
Stefan Beller <sbeller@google.com>
Date
May 8, 2015, 22:13 UTC
Message-ID
<CAGZ79kazifa82bob5RvL4gGarkKympb-aLDBmhT=y7ddTj-aTg@mail.gmail.com>
In-Reply-To
<20150508070906.GC8248@paksenarrion.iveqy.com>
On Fri, May 8, 2015 at 12:09 AM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
Show 24 quoted lines
> On Fri, May 08, 2015 at 08:54:59AM +0200, Kevin Daudt wrote:
>> My experience in #git is that people want to prevent other people
>> accidentelly adding large files, resulting in all sorts of problems,
>> which takes a lot of effort to fix if you're not an experienced user.
>
> I second this. In #git@freenode we often get people trying to reduce
> repo size since they or a collegue accidental added a huge binary file.
>
> They do a filter branch and remove that file. However then they need to
> do a forced push. And the person (the collegue) that didn't had enough
> git experience to understand why it was a mistake to add a big file, now
> ends up with having to sync with a rewritten remote.
>
> So I can really see that there's a demand for such a feature. However, I
> wonder if this shouldn't just be a pre-recieve hook?
>
> If we want to inform the user, we might just add a pre-commit hook for
> this.
>
> The problem with pre-commit hooks is distribution of them. As it is with
> making this a configuration option. There's really no good way to share
> configuration and hooks between git repos today as I know of. (Yes, I'm
> aware of this beeing a hard problem due to security concerns).
>

Any problem in computer science can be solved with another layer of indirection they said. So:

Maybe we can just distribute some good defaults (or your internal distribution for git can ship adapted versions of the default). And instead of just running a hook, maybe the clone/fetch could tell the client to enable these predefined hooks. so maybe we'd need a fetch capability "recommended-hooks" which could look like

    recommended-hooks=<name>,<sha1>

The name would indicate what hook you're interested in such as .git/hooks/pre-commit-warn-huge-size.sample and the sha1 would be the sha1 of that default hook to ensure nobody has tampered with that script.

I am not sure if we need the sha1, maybe that's overengineered. I mean trusting a default script is as much as trusting the git binary on your system, isn't it?

Previous: Fredrik GustafssonNext: Philip Oakley
Message 6 of 7 in “Please consider extending .gitignore to support setting of a file size limit”
  1. Roger MendesMay 7, 2015
  2. Junio C HamanoMay 7, 2015
  3. Thomas KochMay 8, 2015
  4. Kevin DaudtMay 8, 2015
  5. Fredrik GustafssonMay 8, 2015
  6. Stefan BellerMay 8, 2015
  7. Philip OakleyMay 8, 2015

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.