1

Ubuntu 14.04, git 1.9.something

I want to have meld as my git diff <filename> tool. Meld is installed, if I type meld from terminal - it starts.

I made a file /home/den/projects/git_diff_meld.sh:

-rwxrwxr-x  1 den den   27 тра 19 00:47 git_diff_meld.sh*

Inside there's:

#!/bin/bash
meld "$2" "$5"

The I added it as git diff.tool config parameter:

git config --global diff.tool /home/den/projects/git_diff_meld.sh

Config looks like this:

cat .gitconfig
[user]
    email = my.email@lol.com
    name = Den
[color "status"]
    untracked = red normal bold
    changed = cyan normal
    branch = green normal bold
[core]
    editor = subl -n -w
[diff]
    tool = /home/den/projects/git_diff_meld.sh

I have up-to-date project with only difference - I added some comment. I hope to see this difference in meld, so i type git diff irem/src/main/java/com/drobiazko/den/iremember/Reminder.java and that's what I get:

diff --git a/irem/src/main/java/com/drobiazko/den/iremember/Reminder.java b/irem/src/main/java/com/drobiazko/den/iremember/Reminde
index 7f0a221..ac084be 100644
--- a/irem/src/main/java/com/drobiazko/den/iremember/Reminder.java
+++ b/irem/src/main/java/com/drobiazko/den/iremember/Reminder.java
@@ -37,4 +37,6 @@ public class Reminder {
         PrettyTime prettyTime = new PrettyTime();
         return prettyTime.format(date);
     }
+
+    // ;
 }
(END)

...typical out-of-the-box terminal-style diff. No meld.

I've tried lots of things - nothing worked, but this is basic setup to start with.

Den Drobiazko
  • 1,077
  • 1
  • 13
  • 33
  • You said you verified typing "meld" from command line works, but what about when you type from command line what git will execute: "git_diff_meld.sh"? – jordan May 18 '14 at 22:15
  • Well, it works bad: `git_diff_meld.sh: command not found` If one uses `sh git_diff_meld.sh` - then it's ok and meld starts. – Den Drobiazko May 18 '14 at 22:30
  • Well that explains why git can't run it either. Check http://stackoverflow.com/a/137141/3571100 for "Ubuntu" instructions. Did you do exactly that? – jordan May 18 '14 at 22:32
  • Did as it says (both *.sh file location and it's contents) - now it won't show me any diff at all. Neither meld nor built-in diff tool start. System monitor shows no "meld" process running. When I type `/usr/local/bin/git_diff_meld.sh` in terminal by myself - meld starts. – Den Drobiazko May 18 '14 at 22:44
  • can you try "sh /usr/local/bin/git_diff_meld.sh"? (or surround it all with double quotes if required)? – jordan May 18 '14 at 22:47
  • Meld starts if no double quotes. But I misinformed you before: git still shows terminal diff, as in stock. He wasn't before because I was trying to see diff for file not added to track %| So I'm still at the beginning. – Den Drobiazko May 18 '14 at 23:06
  • Sorry, I'm not sure. I would have hoped following those instructions exactly would have worked. What do you think about clearing all config and starting over? – jordan May 18 '14 at 23:11
  • 1
    Actually, it did help: I changed [diff] tool = /home/den/projects/git_diff_meld.sh to [diff] external = /home/den/projects/git_diff_meld.sh and meld now shows me difference. Will you post this all as an answer so I could accept? – Den Drobiazko May 19 '14 at 07:42

1 Answers1

0

As per the discussion above, check https://stackoverflow.com/a/137141/3571100 for "Ubuntu" instructions, and do exactly that. Note the difference between "tool" and "external" in the git config file.

Community
  • 1
  • 1
jordan
  • 959
  • 7
  • 17