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

HerokuSan::Git doesn't handle all git errors #168

Open
jturkel opened this issue Aug 21, 2014 · 0 comments
Open

HerokuSan::Git doesn't handle all git errors #168

jturkel opened this issue Aug 21, 2014 · 0 comments

Comments

@jturkel
Copy link

jturkel commented Aug 21, 2014

There are several methods in HerokuSan::Git that either silently ignore git errors or throw unexpected exceptions. All examples assume the following object:

>> git = Object.new.extend(HerokuSan::Git)
  1. If git command in git_active_branch fails a NoMethodError is thrown
>> Dir.chdir("/tmp")
>> git.git_active_branch
NoMethodError: undefined method `split' for nil:NilClass
    from /Users/jturkel/.rvm/gems/ruby-2.0.0-p481@dandelion/gems/heroku_san-4.3.2/lib/heroku_san/git.rb:15:in `git_active_branch'
  1. If the git command fails in git_rev_parse the first line of the ref arg is returned:
>> git.git_rev_parse("bad")
"bad"
  1. If the git command fails in git_revision nil is returned:
>> git.git_revision('bad-repo')
nil
  1. If the git command fails in git_named_rev an empty string is returned:
>> git.git_named_rev('bad-ref')
""

Note in all cases the git error is echoed to stderr but scripts using this module will continue happily running when they should fail.

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

1 participant