Обсуждение: Can we amend gitignore so git postgresql works with git on windows using Msys/Mingw64

Поиск
Список
Период
Сортировка

Can we amend gitignore so git postgresql works with git on windows using Msys/Mingw64

От
"Regina Obe"
Дата:
Tom et. al,

Thanks for fixing the SRF function order by thing.  That test now passes
now, but there is one other test failing I was going to troubleshoot.

The problem is I can't compile from git postgresql, and the issue is I think
because my git when it pulls down the files they come in as CRLF which gets
all screwed up when compiling under msys/ mingw64.
So I end up with non-sense messages like this:

In file included from libpq-int.h:44:0,                from fe-auth.h:18,                from fe-auth.c:42:
../../../src/include/libpq/pqcomm.h:44:8: error: redefinition of 'struct
sockaddr_storage'struct sockaddr_storage       ^
In file included from ../../../src/include/pg_config_os.h:37:0,                from ../../../src/include/c.h:101,
        from ../../../src/include/postgres_fe.h:25,                from fe-auth.c:23:
 
c:/ming64gcc48/mingw64/x86_64-w64-mingw32/include/winsock2.h:260:10: note:
originally defined here  struct sockaddr_storage {         ^
In file included from libpq-int.h:44:0,                from fe-auth.h:18,                from fe-auth.c:42:
../../../src/include/libpq/pqcomm.h:49:3: error: unknown type name 'int64'  int64  ss_align; /* ensures struct is
properlyaligned */
 


For other projects I work on, I usually put in the .gitattributes these
lines

*.sh        eol=lf
*.in        eol=lf
*.h.in      eol=lf
*.h         eol=lf


Right now to overcome the issue, I always have to run the folder thru
dos2unix or just build from the tar ball instead.

If you don't think it would pose problems for anyone else, that would be
helpful.

I imagine the only people it might are MS VS people, but then they probably
have no issue building from tar ball, which comes out all line feed anyway.
So I assume it wouldn't be an issue for them either.


Thanks,
Regina





Re: Can we amend gitignore so git postgresql works with git on windows using Msys/Mingw64

От
David Rowley
Дата:
On 26 March 2016 at 09:26, Regina Obe <lr@pcorp.us> wrote:
> The problem is I can't compile from git postgresql, and the issue is I think
> because my git when it pulls down the files they come in as CRLF which gets
> all screwed up when compiling under msys/ mingw64.
> So I end up with non-sense messages like this:

Sounds like git is setup to convert the line endings to CRLF.

Check:
git config --list | grep crlf

Likely this will be set to "true"

You can change the setting with:
git config --global core.autocrlf input

drop the --global if you only want to change the current repo.

-- David Rowley                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



Re: Can we amend gitignore so git postgresql works with git on windows using Msys/Mingw64

От
Tom Lane
Дата:
David Rowley <david.rowley@2ndquadrant.com> writes:
> On 26 March 2016 at 09:26, Regina Obe <lr@pcorp.us> wrote:
>> The problem is I can't compile from git postgresql, and the issue is I think
>> because my git when it pulls down the files they come in as CRLF which gets
>> all screwed up when compiling under msys/ mingw64.

> You can change the setting with:
> git config --global core.autocrlf input

Still, it's fair to wonder if we shouldn't add an entry for this to our
.gitattributes.  I'm actually wondering why we wouldn't apply it to ALL
text files in git, not just the extensions Regina mentioned.
        regards, tom lane



Re: Can we amend gitignore so git postgresql works with git on windows using Msys/Mingw64

От
"Regina Obe"
Дата:
> You can change the setting with:
> git config --global core.autocrlf input

> Still, it's fair to wonder if we shouldn't add an entry for this to our
.gitattributes.  I'm actually wondering why we wouldn't apply it to ALL text
files in git, not just the extensions Regina mentioned.
        > regards, tom lane

David,

Thanks for the tip.  I'll give that a try.  Still I think it's safer to use
.gitattributes.

to Tom's comment,
Here is why.  For certain repos, certain files are designated for certain
OS.  So you don't want your developer committer's settings controlling the
output.

Take for example windows specific files.  I do have lines like

*.vcproj    eol=crlf
*.bat        eol=crlf


I don't actually think it much matters even for those if they have LF,
except for batch scripts it looks a bit wonky in some windows editors if
they don't have CRLF breaks.


I'm also not clear what Mac does.  Does Mac still do CR (instead of LF, I
thought it used to).  Does that mean if they switch their ending I'd
suddenly be getting Mac endings?

https://help.github.com/articles/dealing-with-line-endings/

As that above links says - "This file is committed into the repository and
overrides an individual's core.autocrlf setting, ensuring consistent
behavior for all users, regardless of their Git settings." 

I think consistency is more important in this case.


Thanks,
Regina