external diff show empty files sometimes (macosx)

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

434 views 0 1
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you