Re: [PATCH] git-mergetool: Make default smarter by considering user's desktop environment and editor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is what I've been experimenting in my tree; what do people think?

if test -z "$merge_tool" ; then
    if test -n "$DISPLAY"; then
	merge_tool_candidates="kdiff3 tkdiff xxdiff meld gvimdiff"
	if test "$GNOME_DESKTOP_SESSION_ID"x != ""x; then
	    merge_tool_candidates="meld $merge_tool_candidates"
	fi
	if test "$KDE_FULL_SESSION"x = "true"x; then
	    merge_tool_candidates="kdiff3 $merge_tool_candidates"
	fi
    fi
    if echo "${VISUAL:-$EDITOR}" | grep 'emacs' > /dev/null 2>&1; then
	merge_tool_candidates="$merge_tool_candidates emerge"
    fi
    if echo "${VISUAL:-$EDITOR}" | grep 'vim' > /dev/null 2>&1; then
	merge_tool_candidates="$merge_tool_candidates vimdiff"
    fi
    merge_tool_candidates="$merge_tool_candidates opendiff emerge vimdiff"
    echo "merge tool candidates: $merge_tool_candidates"
    for i in $merge_tool_candidates; do
	if test $i = emerge ; then
	    cmd=emacs
	else
	    cmd=$i
	fi
	if type $cmd > /dev/null 2>&1; then
	    echo merge_tool chosen is $i
	    merge_tool=$i
	    break
	fi
    done
fi

						- Ted
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux