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

Add convenience function "clean" #22990

Closed
wants to merge 4 commits into from
Closed

Add convenience function "clean" #22990

wants to merge 4 commits into from

Conversation

odysseus9672
Copy link
Contributor

Add a convenience function named clean that calls rm then add on its argument in sequence. The justification is that it's a way to "clean" a local package that has been marked as "dirty", and return to the clean master version. This function is based on the recommendation of @greg_plowman in response to a question on how to revert dirty packages.
Suggested future improvements: only clean when the package is actually marked as dirty, use git reset --hard type functionality, as suggested by @stevengj.

Add the function eye! that fills its argument with the identity matrix of the appropriate type.
Syncing with upstream fork.
Add a convenience function named `clean` that calls `rm` then `add` on its argument in sequence. The justification is that it's a way to "clean" a local package that has been marked as "dirty", and return to the clean master version. This function is based on the recommendation of @greg_plowman in response to a question on [how to revert dirty packages](https://discourse.julialang.org/t/how-to-revert-dirty-packages/2122).
Suggested future improvements: only clean when the package is actually marked as dirty, use `git reset --hard` type functionality, as suggested by @stevengj.
@tkelman
Copy link
Contributor

tkelman commented Jul 27, 2017

This actually doesn't do what you want. Pkg.rm is somewhat poorly named and doesn't do what you think, it doesn't delete any files. It moves the package to a .trash folder, leaving any modifications in place, in case something else gets added that depends on it or the package gets re-added. So all this operation will do is move the package to .trash then move it back, not fixing whatever local modifications you had. See #7054

@ararslan
Copy link
Member

It should be pretty easy with the LibGit2 bindings to determine whether the package repository is in a dirty state and if so do a hard reset, otherwise do nothing.

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

Successfully merging this pull request may close these issues.

3 participants