Git Product home page Git Product logo

Comments (24)

gornostal avatar gornostal commented on August 23, 2024

@markusgritsch, can you create a gist with a file (or a part of it), where you see the issue?
Also, please provide your git version.

Thanks.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

I already mentioned that I use Git for Windows 2.5. However, I also had the same behaviour with previous versions of Git.

I think the crucial thing to reproduce the bug is to have a file which is in the repository with Unix (LF) line endings which gets checked out on Windows with Windows (CR LF) line endigs. For example this file
https://github.com/nodemcu/nodemcu-firmware/blob/master/Makefile
has LF line endings in the repo (https://github.com/nodemcu/nodemcu-firmware/raw/master/Makefile) but my local clone of this file has CR LF line endings.

So here is an example with exactly that file:
1

Now, if I delete line 3
2

And then press CTRL+ALT+R
3

the spurious CR appears.

Thanks for looking into this.

from modific.

gornostal avatar gornostal commented on August 23, 2024

Hehe, I was wondering what is Window 2.5.
I think I know how to fix it. I'll create a fix, then you verify it, because I don't have access to Windows machine right now.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

Great, looking forward to it.

from modific.

gornostal avatar gornostal commented on August 23, 2024

I just pushed commit to master.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

No, this does not change anything. Note, even if I change join_lines() to return "", a spurious CR appears (of course without any text from the original line):

3

from modific.

gornostal avatar gornostal commented on August 23, 2024

Made another fix. Hope that helps.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

Unfortunately, still the same.

from modific.

gornostal avatar gornostal commented on August 23, 2024

I just made another fix. And I'm pretty sure it will work.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

Still no change. If it helps, when doing
git diff Makefile > tmp.diff
the file tmp.diff has Unix (LF) line endings.

from modific.

gornostal avatar gornostal commented on August 23, 2024

OK. I'll get back to this when I get access to a Windows machine.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

All right.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

Hi gornostal, any chance you will take another look into this issue?

from modific.

gornostal avatar gornostal commented on August 23, 2024

Sorry for the delay.
I'll try to find time for this today or tomorrow.

Thanks for the reminder!

from modific.

gornostal avatar gornostal commented on August 23, 2024

Could not reproduce the bug today.

Here is what I did:

  1. downloaded and installed Git-2.6.3-64.bit.exe on Windows 7
  2. downloaded and installed ST 3
  3. git config --global core.autocrlf true
  4. git checkout https://github.com/nodemcu/nodemcu-firmware
  5. modified a few lines in Makefile
  6. pressed Ctrl+Alt+R
  7. Modific reverted lines just fine, no CR symbols in the end of the line

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

Did you delete some lines in the Makefile so that they were added back when pressing Ctrl+Alt+R?

Reverting works fine with modified lines and added lines. The problem appears only when deleting lines from the original file.

from modific.

gornostal avatar gornostal commented on August 23, 2024

Oh.. I missed that in your description. Will try again today.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

Have you been able to reproduce it?

from modific.

gornostal avatar gornostal commented on August 23, 2024

Not yet. Got distracted at work that day.
Downloading virtual box...

from modific.

gornostal avatar gornostal commented on August 23, 2024

I reproduced it and here is what I found out:

CR appears only if I use \r\n to join the lines.
When I change it to \n, it joins them just fine.

Can you find the line with "\r\n" in Modific.py and change that to \n, then let me know if it works for you?

If it does I will simply add a new config option to manually change line endings, because as it turns out, we cannot use windows line endings on windows in some cases like yours.

from modific.

gornostal avatar gornostal commented on August 23, 2024

Checked in changes to issue-96 branch.
Will merge when @markusgritsch confirms it's working.

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

Yes, this seems to solve the issue, thanks!

But why add a "line_ending" configuration option? Who would need to set this to something else than \n?

from modific.

gornostal avatar gornostal commented on August 23, 2024

It's good to hear it works.

I thought I could break the functionality for someone who needs \r\n, but maybe you are right. I'll use \n.

P.S. Thanks for being insistent :)

from modific.

markusgritsch avatar markusgritsch commented on August 23, 2024

You are welcome ;) I like Modific a lot, and this was the only outstanding issue I had with it. Great that it's fixed now.

Concerning the config option: I think, it is unnecessary. Mind you: The problem with the stray \r characters appeard on a file, which had Windows (\r\n) line endings, and even there the config option has to be set to \n.

Besides: If it would be different from file to file, it would not be practicat to have to change the config option every time.

from modific.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.