external diff show empty files sometimes (macosx)

Riccardo Cohen May 26, 2017

Hello

Quite often, when I open "external diff" (launching excellent Syntevo SmartSynchronize), one of the files extracted in temp dir /var/folders/... is empty ! (using SourceTree 2.5.2 for MacOsX)

I give it here for information :

#!/bin/bash
# SourceTree custom action
# example : /Users/rc/ADL/admin/gitgettemp.sh /Users/rc/E5/dev/git/5flowv2dev mise-en-prod-riccardo.txt 4dcf879789ed246c050494100c3b245db17766e3
#echo $0 $1 $2 $3 $4 $5
dir=$1
filepath=$2
commit=$3
#
cd $dir
branch=`git name-rev --name-only $commit | cut -d \~ -f 1`
commits=`git log --pretty=format:"%H" --all $filepath`
#
echo
echo DIRECTORY=$dir
echo BRANCH=$branch
echo COMMITS=
echo $commits
#
echo
curfound=0
prevcommit=0
for idcom in $commits ; do
if [ "$curfound" == "1" ] ; then
prevcommit=$idcom
curfound=2
fi
if [ "$idcom" == "$commit" ] ; then
curfound=1
fi
done
echo curcommit=$commit, prevcommit=$prevcommit
#
echo
outdir=/Users/rc/zdrop/appdata/gitextract
filename=$(basename $filepath)
if [ "$prevcommit" == "0" ] ; then
echo NOTHING BEFORE
else
echo Exported to $outdir
curfile=${outdir}/${filename}-${commit}
prevfile=${outdir}/${filename}-${prevcommit}
git show $commit:$filepath > $curfile
git show $prevcommit:$filepath > $prevfile
/Applications/soft/SmartSynchronize.app/Contents/MacOS/SmartSynchronize $curfile $prevfile >/dev/null 2>&1
fi
#
echo
echo END

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events