go-git / go-git

A highly extensible Git implementation in pure Go.
https://pkg.go.dev/github.com/go-git/go-git/v5
Apache License 2.0
5.93k stars 735 forks source link

Problem with (LF/CRLF) ? Windows users #594

Open fmargerit opened 2 years ago

fmargerit commented 2 years ago

Hello, I would like to report a problem concerning the clone of a project on a Windows environment.

And I think I have found a clue about some "ghost" files.

The problem is very simple, when cloning using the library, the files have as EOL "LF" instead of "CRLF".

When I type the command "git status" I get files that appear as modified when they have not been modified.

This causes problems in case of checkout and in case of pull.

Here are some examples to demonstrate the problem.

Project cloned by "git clone" command image image

Project cloned by library

image

Working tree with manually clone

image image

Working tree with library's clone

image

NOTE : Only on Windows, after testing on a unix environment I had no problem. This confirms me in the idea that it could come from EOL

In my opinion, I think that the treatments made by git are not applied when cloning the project via the library.

So I'll do some more research, and try to come back to you if I find something else.

It is not possible for me to use the force commands to make pulls.

It is also not possible for me to make a change in the project configuration at this time. I would like it to be done automatically.

Thanks for this great library.

Have a nice evening!

rotty3000 commented 2 years ago

I've also found that line endings are being mishandled. I'd like to be able to rely on the git core.autocrlf configuration but it doesn't appear to be supported.

fmargerit commented 2 years ago

Hello, thank you for the answer.

Indeed I also find that the configuration part is not very well managed, and I find that a pity.

According to my research, it does not take into account the configuration defined by the system, and this is quite worrying for Windows users, who for the moment will have to try to work around the problem in another way.

It is obviously possible to define a configuration using "RAW" but it is not very intuitive, even if it allows to take into account the configuration not present in the basic struct -> core.

The library is really simple to use, but no resources are present to help the developer on the configuration part.

This is one of the black points for me, which will probably make me go back to an alternative such as git2go.

Have a nice day !

github-actions[bot] commented 3 weeks ago

To help us keep things tidy and focus on the active tasks, we've introduced a stale bot to spot issues/PRs that haven't had any activity in a while.

This particular issue hasn't had any updates or activity in the past 90 days, so it's been labeled as 'stale'. If it remains inactive for the next 30 days, it'll be automatically closed.

We understand everyone's busy, but if this issue is still important to you, please feel free to add a comment or make an update to keep it active.

Thanks for your understanding and cooperation!