contrib/difftool: Don't repeat merge tool candidates
git difftool listed some candidates for mergetools twice, depending on the environment. This slightly changes the behavior when both KDE_FULL_SESSION and GNOME_DESKTOP_SESSION_ID are set at the same time; in such a case meld is used in favor of kdiff3 (the old code favored kdiff3 in such a case), but it should not matter in practice. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
David Aguilar committed
Jan 31, 2009 at 12:27 UTC
99ccabaffa201e867f2073947dcccae3947ec4f1
1 file changed
+12
-19
contrib/difftool/git-difftool-helper
+12
-19
@@ -181,31 +181,24 @@ fi
181
182
# Try to guess an appropriate merge tool if no tool has been set.
183
if test -z "$merge_tool"; then
184
-
184
# We have a $DISPLAY so try some common UNIX merge tools
185
if test -n "$DISPLAY"; then
187
- merge_tool_candidates="kdiff3 kompare tkdiff xxdiff meld gvimdiff"
188
- # If gnome then prefer meld
189
- if test -n "$GNOME_DESKTOP_SESSION_ID"; then
190
- merge_tool_candidates="meld $merge_tool_candidates"
191
- fi
192
- # If KDE then prefer kdiff3 or kompare
193
- if test "$KDE_FULL_SESSION" = "true"; then
194
- merge_tool_candidates="kdiff3 kompare $merge_tool_candidates"
186
+ # If gnome then prefer meld, otherwise, prefer kdiff3 or kompare
187
+ if test -n "$GNOME_DESKTOP_SESSION_ID" ; then
188
+ merge_tool_candidates="meld kdiff3 kompare tkdiff xxdiff gvimdiff"
189
+ else
190
+ merge_tool_candidates="kdiff3 kompare tkdiff xxdiff meld gvimdiff"
191
fi
192
fi
197
-
198
- # $EDITOR is emacs so add emerge as a candidate
193
if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
200
- merge_tool_candidates="$merge_tool_candidates emerge"
194
+ # $EDITOR is emacs so add emerge as a candidate
195
+ merge_tool_candidates="$merge_tool_candidates emerge opendiff vimdiff"
196
+ elif echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
197
+ # $EDITOR is vim so add vimdiff as a candidate
198
+ merge_tool_candidates="$merge_tool_candidates vimdiff opendiff emerge"
199
+ else
200
+ merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
201
fi
202
-
203
- # $EDITOR is vim so add vimdiff as a candidate
204
- if echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
205
- merge_tool_candidates="$merge_tool_candidates vimdiff"
206
- fi
207
-
208
- merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
202
echo "merge tool candidates: $merge_tool_candidates"
203
204
# Loop over each candidate and stop when a valid merge tool is found.