2

Installing Meld as a regular Linux package, it is fairly straighforward to setup Meld as git merge tool, here is an extract of my .gitconfig.

[merge]
  tool = meld
[mergetool "meld"]
  trustExitCode = true
  cmd = meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"

But what about the flatpak version of Meld which you cannot execute simply with the command meld? I guess the cmd part should be something like

cmd = flatpak run org.gnome.meld --args --auto-merge \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" --output=\"$PWD/$MERGED\"

but this exact command doesn't work. How should it be modified?

oidualc
  • 1,104
  • 1
  • 14
  • 21

2 Answers2

5

After going through this process today, I figured I would share my final working solution for a 3-way merge. It is based on the possible translation from VonC above.

[merge]
  tool = meld_flatpak

[mergetool "meld_flatpak"]
  cmd = flatpak run --file-forwarding org.gnome.meld \"@@\" $LOCAL \"@@\" \"@@\" $BASE \"@@\" \"@@\" $REMOTE \"@@\" --output \"@@\" $MERGED \"@@\"

[mergetool]
  prompt = false
  keepBackup = false
  writeToTemp = true
Mike
  • 1,297
  • 2
  • 14
  • 22
0

Check if this is similar to flatpak issue 1423:

You need the following command:

My .gitconfig:

[diff]
    tool = meld_flatpak


[difftool "meld_flatpak"]
    cmd = flatpak run --file-forwarding org.gnome.meld \"@@\" $LOCAL \"@@\" \"@@\" $REMOTE \"@@\"


[difftool]
    prompt = false

A possible translation for mergetool (considering the syntax for meld):

cmd = flatpak run --file-forwarding org.gnome.meld $LOCAL \"@@\" $BASE \"@@\" $REMOTE \"@@\" --output=$MERGED \"@@\""
koko
  • 13
  • 3
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Found that already before posting the question, but that's for the difftool. The syntax is quite obscure to me and it's not obvious how to translate it for the mergetool, for example what are those "@@" ? – oidualc Apr 27 '19 at 15:59
  • @oidualc try a similar syntax for mergetool, to see if that does work – VonC Apr 27 '19 at 16:01
  • 1
    @oidualc As mentioned in https://github.com/flatpak/flatpak/issues/543#issue-206280905, the `@@` act as markers (placeholder), so flatpak can find out where the file names to be exported are in the command-line. – VonC Apr 27 '19 at 16:12
  • @koko Thank you for the edit. Much appreciated. – VonC Feb 14 '22 at 21:11