Subject: Re: Git Modifying DLL

From: "brian m. carlson" <[email-masked]>
Date: Fri, 20 Aug 2021 19:14:40 +0000

On 2021-08-20 at 18:47:02, Jonathon Anderson wrote:
> On Fri, Aug 20, 2021 at 1:00 PM Jeff King <[email-masked]> wrote:
> >
> > On Thu, Aug 19, 2021 at 01:21:03PM -0500, Jonathon Anderson wrote:
> >
> > > I had not. I tested that and it worked. I assumed that git would
> > > automatically treat dll files as binary. Thanks for the help!
> >
> > Git doesn't know about any file extensions by default. Its default "is
> > it binary" test looks for NUL bytes in the first 8k or so of the file.
> > I'd expect your DLL would probably have such a NUL byte.
> >
> > Is it possible you have other .gitattributes set which are confusing
> > things?
> >
> > You might try:
> >
> >   git check-attr --all <path>
> >
> > or:
> >
> >   git ls-files --stdin | git check-attr --stdin --all
> >
> > -Peff
> 
> When I remove '*.dll binary" from .gitattributes, I get this:
> 
> $ git check-attr --all ./PSWindowsUpdate.dll
> ./PSWindowsUpdate.dll: text: set
> ./PSWindowsUpdate.dll: eol: lf

Yes, this is definitely not correct.  The flag "text" being set tells
Git to do line-ending conversion and "eol=lf" says to convert line
endings into LF.

You should look for things in your .gitattributes file that say
something like "* text", which you probably don't want.  You could use
"* text=auto", which should be fine for most cases, though.  It's also
possible those aren't in a .gitattributes file in your repository but
one elsewhere on your system.  You can check gitattributes(5) for the
locations of other files that can affect it.

As a note, it is best practice not to check binary dependencies or build
artifacts into the repo.  Those are best stored elsewhere, such as an
artifact server.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA