git shell out hangs if commit message is too long
Redmine Version: 1.2.1
Git Version: 18.104.22.168
When running Repository#fetch_changesets on a Git repository, it will shell out to get the comments for the changeset. It runs something like:
git --git-dir /home/example/git/example.git log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller --reverse 4e6f0873e74e2db0e9f5825dad73ff2e66ae264a..master
git log uses the the default system pager (
more?). If the message is longer than a "page", the shellout command will land in the pager and hang there forever.
You can set the GIT_PAGER=cat environment variable but it's unclear in the SCM adapter how to set environment variables. Another workaround is to have the user set the user's core.pager to
cat in the ~/.gitconfig.
For my own fork (https://github.com/cramerdev/redmine/commit/acb0d46242f0aebfbac2a89fa670190c6aac42db) I sent the environment variable directly to the
cmd variable set by IO.popen, but this is an ugly hack and it would be better if there were an easy way to set environment variables in the SCM adapters. Is there?