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

Determine root of project by looking for .git (or others) #11

Open
rosstimson opened this issue Feb 15, 2014 · 2 comments
Open

Determine root of project by looking for .git (or others) #11

rosstimson opened this issue Feb 15, 2014 · 2 comments

Comments

@rosstimson
Copy link

I recently needed to add encoding comments in a project and remembered that I'd installed this gem. I tried running magic_encoding -h in ~/code and every ruby file in many different projects ended up with # -*- encoding : -h -*- prepended to the file. This has made a huge mess especially trying to work out if git status is showing me files that include changes I was working on or just file with this line added.

Obviously I can fix this but it was pretty annoying and could be a common mistake. I have seen other projects that try and detect the root of a project by looking for the directory that has .git/ (or other VCS files) rather than just recursively going through everything, perhaps this could be implement here.

@mryan43
Copy link
Owner

mryan43 commented Feb 15, 2014

I'm really sorry that happened... however I suppose many of your folders in
~/code had a .git folder in them... so I'm not sure how helpful it would be
to try to detect the root using vsc files... however maybe I could write a
temp file to be able to magic_encoding rollback :)

On Saturday, February 15, 2014, Ross Timson [email protected]
wrote:

I recently needed to add encoding comments in a project and remembered
that I'd installed this gem. I tried running magic_encoding -h in ~/codeand every ruby file in
many different projects ended up with # -- encoding : -h -- prepended
to the file. This has made a huge mess especially trying to work out if git
status is showing me files that include changes I was working on or just
file with this line added.

Obviously I can fix this but it was pretty annoying and could be a common
mistake. I have seen other projects that try and detect the root of a
project by looking for the directory that has .git/ (or other VCS files)
rather than just recursively going through everything, perhaps this could
be implement here.

Reply to this email directly or view it on GitHubhttps://github.com//issues/11
.

@rosstimson
Copy link
Author

No need to apologise, I just wanted to flag it up as a possible issue to help others.

You would only modify files at same level or below the .git folder, this however raises the question about what happens if there is no .git folder as would have been the case for me.

A rollback feature would be awesome or maybe a confirmation prompt showing all of the files which will be prepended before going ahead. This might be easier to code and would've been helpful. I usually hate unnecessary prompting but I think it would be acceptable in this case.

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