Added a warning message when getting symbolic-ref fails.
Refactorings.
Support for aborting a commit (fixes #1).