Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

git-pair-commit not working with JRuby #25

Open
codeword opened this issue Jul 25, 2014 · 3 comments
Open

git-pair-commit not working with JRuby #25

codeword opened this issue Jul 25, 2014 · 3 comments

Comments

@codeword
Copy link

This is when installed via the 'system wide installation' and JRuby is installed via rbenv

The error occurs when the system call is run to do the git commit with the environment variables set. It has to do with the vim instance not having input/output be the terminal.

I modified the installed git_pair.rb to print out the command that it attempts to system and all looks good there and when I run that command myself there is no problem.

here is some output from running git pair-commit with some additional info printed such as what command is being invoked by the system command, what version of ruby the current environment is using and what the RUBY_VERSION constant is set to in the running script.

Committing under jonathan@pivotallabs.com
running 'GIT_AUTHOR_NAME='Jonathan Barnes' GIT_AUTHOR_EMAIL='jonathan@pivotallabs.com' GIT_COMMITTER_NAME='Jonathan Barnes' GIT_COMMITTER_EMAIL='jonathan@pivotallabs.com' git commit '-v''
which: /Users/vdp/.rbenv/versions/jruby-1.7.4/bin/ruby
version: 1.9.3
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal

the net effect of vim not having the input/output set correctly is that some vim like window is presented with the commit message, but the user is unable to get out of visual mode, and thus save and exit the session. You have to ctrl+c to quit vim and the shell itself is also busted and needs to be killed.

@patrick99e99
Copy link

I've seen this happen before, and it was because git was not configured
to use vim properly. Did you try doing:

export GIT_EDITOR=vim

?

By the way, I don't know if you know or not-- but I quit Pivotal. It
was really nice working with you, and I hope some day to play you at
ping pong again.

Patrick J. Collins
http://collinatorstudios.com

On Thu, 24 Jul 2014, Jonathan Barnes wrote:

This is when installed via the 'system wide installation' and JRuby is
installed via rbenv

The error occurs when the system call is run to do the git commit with the
environment variables set. It has to do with the vim instance not having
input/output be the terminal.

I modified the installed git_pair.rb to print out the command that it
attempts to system and all looks good there and when I run that command
myself there is no problem.

here is some output from running git pair-commit with some additional info
printed such as what command is being invoked by the system command, what
version of ruby the current environment is using and what the RUBY_VERSION
constant is set to in the running script.

Committing under jonathan@pivotallabs.com
running 'GIT_AUTHOR_NAME='Jonathan Barnes' GIT_AUTHOR_EMAIL='jonathan@pivota
llabs.com' GIT_COMMITTER_NAME='Jonathan Barnes' GIT_COMMITTER_EMAIL='jonatha
n@pivotallabs.com' git commit '-v''
which: /Users/vdp/.rbenv/versions/jruby-1.7.4/bin/ruby
version: 1.9.3
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal

the net effect of vim not having the input/output set correctly is that some
vim like window is presented with the commit message, but the user is unable
to get out of visual mode, and thus save and exit the session. You have to
ctrl+c to quit vim and the shell itself is also busted and needs to be
killed.


Reply to this email directly or view it onGitHub.[28946__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyMTg3MDE1
MiwiZGF0YSI6eyJpZCI6Mzc5MzE4Mjl9fQ==--076459201b6e10421cac67275e5205701e15e
071.gif]

@codeword
Copy link
Author

no vim is setup as the git editor. I think it has something to do with JRuby's ability to make system calls. Maybe the environment is not available to it in the same way as MRI rubies

@codeword codeword changed the title git-pair-commit not working with JRuby v1.7.4 git-pair-commit not working with JRuby Jul 25, 2014
@codeword
Copy link
Author

I think this article strongly hints that system calls expecting a terminal environment won't work in JRuby:
http://blog.headius.com/2009/05/fork-and-exec-on-jvm-jruby-to-rescue.html

codeword pushed a commit to codeword/sprout-wrap that referenced this issue Jul 28, 2014
git-pair-commit requires ruby to make a system call to git-commit, but that
causes problems when using JRuby as it is running in a JVM and does not have
access to the environment when making system calls.  See issue:
vmware-archive/git_scripts#25 for more details
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants