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

Diff parsing fails with opaque error when SSH warnings preceed the standard header #574

Closed
aalong-tr opened this issue Apr 19, 2022 · 3 comments

Comments

@aalong-tr
Copy link

Subject of the issue

I'm experiencing a transient error in a CI environment using the Danger gem. The exception and relevant stack trace:

undefined method `[]' for nil:NilClass
/home/circleci/repo/vendor/bundle/ruby/2.7.0/gems/git-1.10.2/lib/git/diff.rb:148:in `block in process_full_diff'
/home/circleci/repo/vendor/bundle/ruby/2.7.0/gems/git-1.10.2/lib/git/diff.rb:131:in `each'
/home/circleci/repo/vendor/bundle/ruby/2.7.0/gems/git-1.10.2/lib/git/diff.rb:131:in `process_full_diff'
/home/circleci/repo/vendor/bundle/ruby/2.7.0/gems/git-1.10.2/lib/git/diff.rb:110:in `process_full'
/home/circleci/repo/vendor/bundle/ruby/2.7.0/gems/git-1.10.2/lib/git/diff.rb:68:in `each

I have identified the root cause as git diff output that includes an SSH key warning:

Warning: Permanently added the ECDSA host key for IP address '000.00.000.0' to the list of known hosts.
diff --git a/some/file/name b/some/file/name

(IP address obscured)

While SSH warnings are not necessarily the responsibility of this gem, better error handling with explicit explanation of why the git diff output did not match expected formatting would make this style of error significantly easier to identify and fix.

Your environment

  • ruby-git version 1.10.2
  • Ruby version 2.7.0
@aalong-tr
Copy link
Author

Proposed fix in #585

@jcouball
Copy link
Member

Fixed with #684 and released in git-2.0.0-pre1

@aalong-tr
Copy link
Author

Fabulous news, thank you so much for this refactor!

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 a pull request may close this issue.

2 participants