Improve Beyond Compare integration with git

This commit is contained in:
Josh Holtrop 2021-03-26 15:15:24 -04:00
parent 5efd2ced47
commit c1a3af31f0
6 changed files with 30 additions and 31 deletions

View File

@ -18,13 +18,12 @@ 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
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
git config --global alias.bcdiff 'difftool -y -t bc'
git config --global alias.bcdiffc 'difftool -y -t bc --cached'
git config --global difftool.bc.cmd 'git_bcdiff "$LOCAL" "$REMOTE" "$MERGED"'
git config --global alias.bcmerge 'mergetool -y -t bc'
git config --global mergetool.bc.cmd \
'git_bcmerge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"'
git config --global alias.authors '!git log --pretty="%an" | sort | uniq -c | sort -n'
}
function git-config-local-personal()

View File

@ -1,14 +0,0 @@
#!/bin/bash
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

View File

@ -1,10 +0,0 @@
#!/bin/bash
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

12
git_bcdiff Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
local_fname="$1"
remote_fname="$2"
merged_fname="$3"
bcompare "$local_fname" "$remote_fname" -title1="$merged_fname" -title2="$merged_fname" -leftreadonly &
# 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 0.5

8
git_bcmerge Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
local_fname="$1"
remote_fname="$2"
base_fname="$3"
merged_fname="$4"
exec bcompare "$local_fname" "$remote_fname" "$base_fname" "$merged_fname" -title1="$merged_fname : local" -title2="$merged_fname : remote" -savetarget="$merged_fname"

View File

@ -6,3 +6,7 @@
tags
/.todo
/.bundle/
/.issues
/.ruby-version
/.ruby-gemset
/_local/