You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the output of ls-remote command is parsed both stout and stderr parsed, what causes the script to fail because of the unexpected git command output.
Git.ls_remote working even if something fails into stderr.
Output to stderr parsed separately from stdout.
IDK how complicated is it, but why not switch Open3::popen3 as command runner?
Steps to reproduce
You should have output in stderr for your git command. Then Git.ls_remote will fail.
Actual behaviour
When running Git.ls_remote and stderr isn't empty, the parsing of ls-remote command will fail because warning in the output causes:
NoMethodError: undefined method `split' for nil:NilClass
/opt/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/git-1.5.0/lib/git/lib.rb:419:in `block (2 levels) in ls_remote'
/opt/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/git-1.5.0/lib/git/lib.rb:417:in `each'
/opt/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/git-1.5.0/lib/git/lib.rb:417:in `block in ls_remote'
/opt/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/git-1.5.0/lib/git/lib.rb:416:in `tap'
/opt/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/git-1.5.0/lib/git/lib.rb:416:in `ls_remote'
/opt/rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/git-1.5.0/lib/git.rb:149:in `ls_remote'
....
The reason is that git commands on this host for some reason output warnings about hostkey everytime. And I still searching for the reasons, why ~/.ssh/known_hosts file in the home is ignored, but I believe that this kind of warnings shouldn't fail program execution.
When I running my script, I'm getting:
RSA host key for IP address '**********' not in list of known hosts.
Which then not splitted by the tabs because there are no tabs in this string
I checked the output of the command manually with and without stderr redirection to the /dev/null. as we can see with suppressed stderr script will not fail.
[serhii@host ~] :) git ls-remote 'ssh://git@*********:*****/******.git'
RSA host key for IP address '**********' not in list of known hosts.
5992e82a52648a6348e42bad853ee32ae06d4c5a HEAD
249d61415a4ea902e453ebb3868835b9e340fc71 refs/heads/**********
4d50c9c33c15e96333f0543a53ae5599b8e7c0a9 refs/heads/alpha/develop
5992e82a52648a6348e42bad853ee32ae06d4c5a refs/heads/master
c7fdfcd41cab3c419d3b8f94977b395bef25fabf refs/heads/************
[serhii@host ~] :) git ls-remote 'ssh://git@*********:*****/******.git' 2>/dev/null
5992e82a52648a6348e42bad853ee32ae06d4c5a HEAD
249d61415a4ea902e453ebb3868835b9e340fc71 refs/heads/**********
4d50c9c33c15e96333f0543a53ae5599b8e7c0a9 refs/heads/alpha/develop
5992e82a52648a6348e42bad853ee32ae06d4c5a refs/heads/master
c7fdfcd41cab3c419d3b8f94977b395bef25fabf refs/heads/************
P.S.: Also wondering why ls_remote doesn't support listing tags, but that's another issue.
The text was updated successfully, but these errors were encountered:
Subject of the issue
When the output of
ls-remote
command is parsed both stout and stderr parsed, what causes the script to fail because of the unexpected git command output.Your environment
Expected behaviour
Git.ls_remote working even if something fails into stderr.
Output to stderr parsed separately from stdout.
IDK how complicated is it, but why not switch
Open3::popen3
as command runner?Steps to reproduce
You should have output in stderr for your git command. Then
Git.ls_remote
will fail.Actual behaviour
When running Git.ls_remote and stderr isn't empty, the parsing of ls-remote command will fail because warning in the output causes:
The reason is that git commands on this host for some reason output warnings about hostkey everytime. And I still searching for the reasons, why
~/.ssh/known_hosts
file in the home is ignored, but I believe that this kind of warnings shouldn't fail program execution.When I running my script, I'm getting:
Which then not splitted by the tabs because there are no tabs in this string
ruby-git/lib/git/lib.rb
Line 501 in e2fd4af
I checked the output of the command manually with and without stderr redirection to the /dev/null. as we can see with suppressed stderr script will not fail.
P.S.: Also wondering why ls_remote doesn't support listing tags, but that's another issue.
The text was updated successfully, but these errors were encountered: