From 4bce7a84b6c508cba492c3ec0d97fc24fe1b541c Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 16 Aug 2016 14:45:21 -0400 Subject: [PATCH] git config: support bcdiff/bcmerge from linux as well --- bash_aliases | 16 +++++++--------- git_bc3diff | 17 +++++++++++++---- git_bc3merge | 14 +++++++++----- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/bash_aliases b/bash_aliases index dda31f4..652b7a3 100755 --- a/bash_aliases +++ b/bash_aliases @@ -182,15 +182,13 @@ function git-config-joshs() git config --global alias.mktarxz '!function f { name="$1"; pos="$2"; if [ "$pos" == "" ]; then pos=HEAD; fi; git archive --prefix="$name"/ "$pos" | xz > ../"$name".tar.xz; }; f' git config --global alias.amd 'am --committer-date-is-author-date' git config --global push.default upstream - if [ -e /bin/cygwin1.dll ]; then - git config --global alias.bcdiff 'difftool -y -t bc3' - git config --global alias.bcdiffc 'difftool -y -t bc3 --cached' - git config --global difftool.bc3.cmd 'git_bc3diff "$LOCAL" "$REMOTE"' - git config --global alias.bcmerge 'mergetool -y -t bc3' - git config --global mergetool.bc3.cmd \ - 'git_bc3merge "$LOCAL" "$REMOTE" "$MERGED"' - git config --global mergetool.bc3.trustExitCode false - fi + git config --global alias.bcdiff 'difftool -y -t bc3' + git config --global alias.bcdiffc 'difftool -y -t bc3 --cached' + git config --global difftool.bc3.cmd 'git_bc3diff "$LOCAL" "$REMOTE"' + git config --global alias.bcmerge 'mergetool -y -t bc3' + git config --global mergetool.bc3.cmd \ + 'git_bc3merge "$LOCAL" "$REMOTE" "$MERGED"' + git config --global mergetool.bc3.trustExitCode false } function git-config-local-personal() { diff --git a/git_bc3diff b/git_bc3diff index e4e3c31..d5bc2b0 100755 --- a/git_bc3diff +++ b/git_bc3diff @@ -1,5 +1,14 @@ -#!/bin/sh +#!/bin/bash -path1=$(cygpath -w "$1") -path2=$(cygpath -w "$2") -'/cygdrive/c/Program Files (x86)/Beyond Compare 3/BComp.exe' "$path1" "$path2" /title1=Base /leftreadonly +if [[ $(uname) =~ CYGWIN ]]; then + path1=$(cygpath -w "$1") + path2=$(cygpath -w "$2") + '/cygdrive/c/apps/Beyond Compare 3/BCompare.exe' "$path1" "$path2" /title1=Base /leftreadonly & +else + bcompare "$1" "$2" -title1=Base -leftreadonly & +fi + +# git will remove the temporary file as soon as the difftool command exits; +# sleep to give Beyond Compare a chance to load the file and display the diff +# before the file is removed. +sleep 1 diff --git a/git_bc3merge b/git_bc3merge index ae8c13c..927b8d2 100755 --- a/git_bc3merge +++ b/git_bc3merge @@ -1,6 +1,10 @@ -#!/bin/sh +#!/bin/bash -local=$(cygpath -w "$1") -remote=$(cygpath -w "$2") -merged=$(cygpath -w "$3") -'/cygdrive/c/Program Files (x86)/Beyond Compare 3/BComp.exe' "$local" "$remote" /title1=Local /title2=Remote /savetarget="$merged" +if [[ $(uname) =~ CYGWIN ]]; then + local=$(cygpath -w "$1") + remote=$(cygpath -w "$2") + merged=$(cygpath -w "$3") + '/cygdrive/c/apps/Beyond Compare 3/BCompare.exe' "$local" "$remote" /title1=Local /title2=Remote /savetarget="$merged" +else + bcompare "$1" "$2" -title1=Local -title2=Remote -savetarget="$3" +fi