4

When external diff is configured, results are displayed per file, i.e. to view differences for the next file one needs to close currently running diff viewer.

Is there a way to make git spawn all diff viewer processes in parallel?

If I just spawn process from within external diff script, apparently git deletes the temporary files it uses for comparison.

So

#!/usr/bin/python
import subprocess
import sys
p = subprocess.Popen(('/usr/bin/meld', sys.argv[2], sys.argv[5]))
#p.wait()

does not work, with meld displaying 'Could not read from '/tmp/.diff_VlLwKF'

However, if I uncomment

#p.wait()

everything works fine, but again, it's sequential spawning, not parallel.

Thanks

Art
  • 23,747
  • 29
  • 89
  • 101
  • What environment are you using? It should be possible to write a wrapper than spawns a viewer in the background and use this as your difftool. – CB Bailey Aug 11 '09 at 08:24
  • Please see question, added some more info – Art Aug 11 '09 at 08:39
  • I think you can configure git to not delete temporary files it uses for comparison (see git-config/git-difftool manpage). – Jakub Narębski Aug 11 '09 at 10:06
  • How is the external diff configured? I simply set the PAGER environment variable to my external program and I get the complete diff file in it. – drrlvn Aug 17 '09 at 13:36

2 Answers2

6

I asked a similar question on SO, wanting to open diff files in tabs in BeyondCompare. I came up with this:

for name in $(git diff --name-only $1); do git difftool $1 $name & done

This gets the list of modified files and calls the external diff tool in a background task on each separate file.

Check out the details here and how I make it easy to use. Being new to bash I'd love to hear of any improvements...

Edit 1: added optional param (eg '--staged')
Edit 2: added git alias (see link).

Community
  • 1
  • 1
Seba Illingworth
  • 5,672
  • 3
  • 27
  • 25
0

Instead of calling the difftool for each files, you could let git do that for you, starting with (git 1.7.11, June 2012):
It can now diff directories (ie display all the files to be compared, before opening the difftool)

See "git difftool to give directory compare?"

So maybe you can now use one call, with directory diff.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250