Giter VIP home page Giter VIP logo

Comments (4)

nylen avatar nylen commented on September 21, 2024 1

Just a theory, maybe when you use git on windows then git archive thinks it should produce an archive with CRLF endings since that is the platform default?

I usually make a shell script that is responsible for generating the release builds and check that in to the repository, you can see an example here: https://github.com/ClassicPress/ClassicPress-Migration-Plugin/blob/master/bin/build-plugin-zip.sh

However if you can get git archive working as intended then this might not be necessary.

I do switch between Linux and Windows but even when using Windows, my editor is set to use LF

This sounds right. git has some features to convert between line endings but I think they should never have added that at all, and just using LF everywhere is a much better idea.

I believe adding * text eol=lf to .gitattributes may help.

I haven't had to use this feature myself and reading through the documentation was not immediately illuminating. That might help, but one issue is that you don't want to be treating images, fonts and other binary files as text and possibly having git try to convert them between different line endings, which would corrupt their contents.

First I would try this on your Windows machine: change to the classicpress-seo repository and run git config core.eol lf to set the default line-ending style in that repository, then try git archive and see what kind of line endings come through there. If that works then you won't need to mess around with line endings in .gitattributes anymore, in fact you should be able to delete that line from .gitattributes.

Or I guess you could try building the releases from Linux.

Is it OK to add .gitattributes and .gitignore to .gitignore?

These files should still be included in the git repository, so they shouldn't be added to .gitignore. It looks like you can tell git archive to skip them when exporting, using this attribute: https://www.git-scm.com/docs/gitattributes#_export_ignore


I'm not sure how much time is worth spending on this anyway... it's a pretty minor thing and I already spent a lot longer than I thought I would trying to make sense of the git documentation.

from classicpress-seo.

nylen avatar nylen commented on September 21, 2024

How is the release package currently built?

The line endings are also getting converted to CR+LF (Windows line endings) which is making git complain. Released plugins should probably use LF (Unix) line endings.

from classicpress-seo.

timbocode avatar timbocode commented on September 21, 2024

contains .gitattributes and .gitignore files, these should be removed in the release process

I've had a look into this and have seen conflicting advice.

Is it OK to add .gitattributes and .gitignore to .gitignore? Or are they best added to .git/info/exclude? Or something else?


How is the release package currently built?

https://github.com/ClassicPress-plugins/classicpress-seo/releases/tag/v1.0.0-beta.4
... is created using GitHub "Create a new release".

https://github.com/ClassicPress-plugins/classicpress-seo/releases/download/v1.0.0-beta.4/classicpress-seo.zip
... is created using the following command:

git archive --prefix=classicpress-seo/ -o "classicpress-seo.zip" HEAD


The line endings are also getting converted to CR+LF

I don't know why this is. I do switch between Linux and Windows but even when using Windows, my editor is set to use LF and even if it's not, GitHub Desktop is supposed to convert CRLF line endings to LF (or at least give a warning). I also have the following line in .gitattributes although I'm not convinced this does anything by itself:

* text=auto

I believe adding * text eol=lf to .gitattributes may help.

Any thoughts on this?

I shall investigate.

from classicpress-seo.

timbocode avatar timbocode commented on September 21, 2024

Thanks for the detailed info.

I've added the following lines to .gitattributes in PR #96

.gitignore export-ignore
.gitattributes export-ignore

so git archive will exclude these two files now.

I've also run git config core.eol lf on my Windows repo but, in any case, I think the best thing to do is, as you say, a) only build releases on Linux, and b) use a bash script similar to the one you use for the migration plugin. That's what I intend doing from now on.

So I will close this issue when I merge #92.

from classicpress-seo.

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.