Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output piped via PowerShell on Windows into .gitignore not recognized by git #61

Open
paulirwin opened this issue Oct 7, 2015 · 2 comments

Comments

@paulirwin
Copy link

Steps to reproduce:

  1. Open PowerShell to a new empty git repo
  2. Create a file or folder (with a file in the folder) that should be ignored, such as a "bin" folder for the "visualstudio" template
  3. Run joe visualstudio > .gitignore per the documentation in README
  4. Run git add .
  5. Run git status. Note that the "bin" folder has been added as a staged change, despite being ignored.

This is due to PowerShell using some UTF-8 marks that git doesn't like but for some reason git doesn't warn you. You can see this output in Atom, with some line ending issues as well (note the presumably Unicode-related marks at the beginning of the file):

image

Note that if you run echo "bin/" > .gitignore it also doesn't work - so this is definitely a problem with either PowerShell or git, and not a problem with Joe. Also of note is that the piping works if this is run from Git Bash which is installed with Git for Windows. However, this means that either Joe should have functionality to create the .gitignore without redirecting standard output (such as a --create flag), and the documentation should at least be updated to note that redirecting output with > in PowerShell results in a file that is not usable by git. Unless there's some other way to work around this limitation in PowerShell.

@awarrenlove
Copy link

You probably want to look into https://technet.microsoft.com/en-us/library/hh849882.aspx. PowerShell defaults to Unicode output if you use '>', so you must instead pipe to out-file and set the encoding there.

@paulirwin
Copy link
Author

@awarrenlove Workarounds like that are acceptable, but updating the docs/readme to reflect that would be in order (if that's the only option) since the readme as-is doesn't work in PowerShell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants