Git Product home page Git Product logo

Comments (4)

hadley avatar hadley commented on September 14, 2024 1

It's possible that testthat uses the unix line endings for all the text it generates but it's possible that pkgdown is producing OS-varying line endings. Regardless, testthat should automatically process snapshots to remove \r.

from testthat.

hadley avatar hadley commented on September 14, 2024

Snapshot files should already be written with consistent line ending, so if you're seeing problems that's definitely a bug.

from testthat.

olivroy avatar olivroy commented on September 14, 2024

Oh, okay! Cool.

But I am surprised to see it hasn't come up before...

The simple way to get this is simply to work with snapshots on mac and Windows and you start seeing some ghost diffs appear.

I thought this was a pure git problem:

Here is what I tried:

  • Using specific line ending in .Rproj
  • Try to configure it git wise (I don't really understand this)
  • Try to set gitattributes line ending for snapshots, but I couldn't resolve it.

I still think it can be solved with using the correct git setting. If it is, it may be worth documenting it?

I always end up with this in the git pane.
image

then I stage them
image

It is especially annoying when working with usethis::pr_*() functions as I need to do a manual step before proceeding.

It makes it hard to distinguish between snapshots that changed vs remained the same.

from testthat.

olivroy avatar olivroy commented on September 14, 2024

I think I finally found a way to mitigate that. Using the Posix line ending option in .Rproj seems to work pretty well!

image

This is not the default option, but for some collaborative projects, it may be worth using. Also, using core.autocrlf = true git config is not a good idea (unless all collaborators have this setting, but there is no good way to do this)

use_git_config(scope = "project", "core.autocrlf" = "false")

Seems to work well now. But I am stuck with a .Rproj always in diff. rstudio/rstudio#1929

from testthat.

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.