IBM / ibmi-oss-issues

Important resources for anyone interested in open source on IBM i
Creative Commons Zero v1.0 Universal
13 stars 0 forks source link

Git and Less #33

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi,

when I enter the command "git log" I get the message "error: cannot run less: No such file or directory". Git is installed and Less is installed too.

When I enter the command "less --help" I get the message "WARNING: terminal is not fully functional". When I set the environment variable TERM to xterm, then the command works. I found the solution for this here.

https://blog.rtwilson.com/how-to-fix-warning-terminal-is-not-fully-functional-error-on-windows-with-cygwinmsysgit/

I found another article, that the pager for git has to be configured. I tried this, but without success. The article is here.

https://itenium.be/blog/dev-setup/git-core-pager-less-pager/

Is there`s a way to use a pager for git on IBM i?

Regards

Frank

kadler commented 1 year ago

Do you have /QOpenSys/pkgs/bin on your PATH? If it is, git should be able to run it just fine. Since you say you can run less --help, that would seem to me that your PATH should be set correctly, though if you ran it unqualified.

As to the TERM setting, this is usually set by your terminal emulator and passed through SSH. Are you running from SSH or QSH/QP2TERM? If SSH, what client are you using (PuTTY, TeraTerm, ssh, etc)?

ghost commented 1 year ago

I ran the "git log" from QSH. Now I tried it from my pc with "Git Bash" and it worked. Is it possible to make it work from QSH? On our own system of course I can use "Git Bash", but thats not possible on customer systems. On customer systems I have e.G. Microsoft Teams or Teamviewer and then I can start QSH, but I cannot start "Git Bash". Its to much to explain to the customer he has to install "Git Bash" on his pc.

Generally speaking, I have the need to run .sh scripts with git commands in batch jobs invoked by QSH. I use QSH, because the program who`s calling the script can retrieve the return code set by the script. Prior to calling QSH I set the following environment variables.

QIBM_MULTI_THREADED : 'Y' QIBM_QSH_CMD_OUTPUT : 'NONE' QIBM_QSH_CMD_ESCAPE_MSG : 'Y' QIBM_CCSID : '1208' PASE_LANG : 'EN_US' QIBM_PASE_CCSID : '1208' PATH : '/QOpenSys/pkgs/bin:/usr/bin:.:/QOpenSys/usr/bin'

From your point of view, is there`s a problem to use QSH and scripts with git commands?

kadler commented 1 year ago

From a 5250 environment (either QSH or QP2TERM) you will not get a proper Unix terminal behavior that some applications expect. Many programs work fine, but programs like pagers won't work properly. I would suggest setting git's pager to cat, eg. git config --global core.pager cat or setting PAGER=cat, then relying on page up/down within QSH for paging.

From your point of view, is there`s a problem to use QSH and scripts with git commands?

No, in general there is no issue.

ghost commented 1 year ago

Thank you for this information. This helped.