Re: PSA: Mark SVG as binary

2023-03-03 Thread Ben Cooksley
On Sat, Mar 4, 2023 at 11:03 AM Ingo Klöcker  wrote:

> On Freitag, 3. März 2023 22:49:06 CET Ben Cooksley wrote:
> > In all cases i'm aware of, the files have been in either SVG, JSON or XML
> > in format.
> >
> > To fix this, and allow changes to be merged please add a ".gitattributes"
> > file at the top level of the Git repository you are seeing this behaviour
> > in on the master branch with the following contents:
> >
> > *.svg binary
>
> Wouldn't replacing the *.svg files with compressed SVGs also solve the
> problem?
> If git is anyway told to treat the SVGs as binary, then keeping them as
> uncompressed text files makes little sense to me. Of course, there may be
> valid
> exceptions, but I'm certain that in general replacing the uncompressed
> SVGs
> with compressed SVGs would be fine.
>

Yes it would, however that would defeat the ability of Git's data
compression capabilities to keep the size of our repositories down so we
should still keep them as text files.
The .gitattributes file as far as I am aware does not influence that part
of Git, it is used by the parts relating to generating diffs and converting
EOL formats between operating systems (among others).


>
> Regards,
> Ingo


Cheers,
Ben


Re: PSA: Mark SVG as binary

2023-03-03 Thread Ingo Klöcker
On Freitag, 3. März 2023 22:49:06 CET Ben Cooksley wrote:
> In all cases i'm aware of, the files have been in either SVG, JSON or XML
> in format.
> 
> To fix this, and allow changes to be merged please add a ".gitattributes"
> file at the top level of the Git repository you are seeing this behaviour
> in on the master branch with the following contents:
> 
> *.svg binary

Wouldn't replacing the *.svg files with compressed SVGs also solve the problem? 
If git is anyway told to treat the SVGs as binary, then keeping them as 
uncompressed text files makes little sense to me. Of course, there may be valid 
exceptions, but I'm certain that in general replacing the uncompressed SVGs 
with compressed SVGs would be fine.

Regards,
Ingo

signature.asc
Description: This is a digitally signed message part.


PSA: Mark SVG as binary

2023-03-03 Thread Ben Cooksley
Hi all,

Over the past few months Sysadmin has periodically received reports of our
Git hooks failing when processing commits in certain circumstances.

Looking at all of these instances a clear trend has emerged, with files
that have lines in them that are extremely and excessively long being the
culprit of this issue. In all instances, the files in question have been
generated by software and not been written by humans.

While it is not entirely clear why this issue has suddenly appeared (as the
code within the Git hooks causing the failure has been in production for
10+ years) I am suspecting a change in behaviour in either Git or Python to
be the cause of this (with Git being most likely).

In all cases i'm aware of, the files have been in either SVG, JSON or XML
in format.

To fix this, and allow changes to be merged please add a ".gitattributes"
file at the top level of the Git repository you are seeing this behaviour
in on the master branch with the following contents:

*.svg binary

Amending as needed to cover other files that also contain content that has
a meaningless diff.

Note that the file *must* be placed at the root of the repository and on
the master branch, otherwise it will not be propagated by GitLab to our
hooks.

Thanks,
Ben