tags:

views:

1051

answers:

1

Hi,

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

+5  A: 

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).

Seba Illingworth
Excellent, that's what I need! Thanks!
Art