LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Problem using Kate as git editor (https://www.linuxquestions.org/questions/linux-software-2/problem-using-kate-as-git-editor-4175581416/)

hydrurga 06-04-2016 04:51 AM

Problem using Kate as git editor
 
Being more used to Kate than Nano, the default git editor on my system, I issued:

Code:

sudo git config --system core.editor kate
Kate launches ok when I make a commit, but git doesn't hang around for Kate to return, immediately outputting an "Aborting commit due to empty commit message" error.

Perusing the web, I see that several other editors can be invoked with the -w flag to force git to wait for the external editor to close (or save?) before continuing. However I can't seem to find a way of doing this for Kate.

As a fall-back if it can't be done, what's the closest alternative to Kate out there?

Many thanks.

Turbocapitalist 06-04-2016 05:58 AM

As you point out, kate seems to have no built in option. Just a wild guess at a work-around:

Code:

sudo git config --system core.editor "kate & wait"

hydrurga 06-04-2016 06:10 AM

Quote:

Originally Posted by Turbocapitalist (Post 5555781)
As you point out, kate seems to have no built in option. Just a wild guess at a work-around:

Code:

sudo git config --system core.editor "kate & wait"

Thanks, TC. The above command launched a new instance of Kate, despite one already being open, but didn't populate it with the normal git commit text. On top of that, saving then closing this new instance didn't shake git out of its wait mode, neither did closing the original instance of Kate.

Using the command with no instances of Kate already running showed the same problem.

For info, errors/warnings generated on the command line were:

Code:

QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
Bus::open: Can not get ibus-daemon's address.
IBusInputContext::createInputContext: no connection to ibus-daemon

However, these are normally generated each time I run kate from the command line.

norobro 06-04-2016 11:32 AM

No help, but FYI kate works as the git editor on my Debian Sid box.
Code:

$ git --version
git version 2.8.1
$ kate --version
kate 16.04.1

Does it work if you change the editor for the repository?
Code:

$ git config --local core.editor kate
FWIW I get different warnings when starting kate:
Code:

$ kate
QObject::connect: invalid null parameter
QObject::connect: invalid null parameter
QObject::connect: Cannot connect (null)::returnPressed() to KUrlRequester::returnPressed()
QObject::connect: Cannot connect (null)::returnPressed(QString) to KUrlRequester::returnPressed(QString)


Turbocapitalist 06-04-2016 12:16 PM

There is an ugly work around. If you wrap kate in a shell script and then tell git to use the shell script then everything works out.

Code:

#!/bin/sh

/usr/bin/kate $@

That will allow kate to edit the commit message and it can be verified with "git log"

norobro's question suggests to me that you should search for a bug report with git and kate and there isn't any for your versions to file one.

hydrurga 06-04-2016 04:25 PM

Quote:

Originally Posted by norobro (Post 5555868)
Does it work if you change the editor for the repository?
Code:

$ git config --local core.editor kate

So, one of those quirky things that sometimes happens with software just happened.

I used
Code:

$ git config --local core.editor kate
as you suggested. It worked!

So, I then decided to test exactly what was going on and checked my --local, --global and --system core.editor settings - all were set to kate.

I removed the --local one to see if it would still work. It did. I removed the --global one to see if it would still work. It did.

So now I'm back at a situation that was ostensibly the one which gave me problems in the first place, but now works.

The only thing that I can think of is that the --local one was set to something strange before I changed it above. Anyway it works, so I'll mark the thread as solved, with thanks to all, but particularly to the little goblin who lives in my computer and sometimes sprinkles his magic dust around.

hydrurga 06-04-2016 04:27 PM

Quote:

Originally Posted by Turbocapitalist (Post 5555887)
There is an ugly work around. If you wrap kate in a shell script and then tell git to use the shell script then everything works out.

Code:

#!/bin/sh

/usr/bin/kate $@

That will allow kate to edit the commit message and it can be verified with "git log"

norobro's question suggests to me that you should search for a bug report with git and kate and there isn't any for your versions to file one.

I didn't get round to this, but thanks for the suggestion!

Spharx 07-15-2016 03:22 PM

For me ' ... core.editor "kate -b" ' works.


All times are GMT -5. The time now is 09:09 AM.