Files
godOfGit/B_Compare.sh

67 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
#set -x
tmpDir=/tmp/X_tmp
[ -f {$tmpDir} ] && rm -rf "${tmpDir}"
mkdir -p "${tmpDir}"
cd 9_goal
git status --short > "${tmpDir}/goalStatus.txt"
git ls-files > "${tmpDir}/goalStageFiles.txt"
git log origin/master...master --pretty=format:%D > "${tmpDir}/goalPushState.txt"
git branch -a | sort > "${tmpDir}/goalBranchSetup.txt"
git remote -v | sort > "${tmpDir}/goalRemotes.txt"
cd ..
cd 5_work
git status --short > "${tmpDir}/workStatus.txt"
git ls-files > "${tmpDir}/workStageFiles.txt"
git log origin/master...master --pretty=format:%D > "${tmpDir}/workPushState.txt"
git branch -a | sort > "${tmpDir}/workBranchSetup.txt"
git remote -v | sort > "${tmpDir}/workRemotes.txt"
cd ..
cd "${tmpDir}"
sed -i '$a\' *.txt
echo -n "STATUS - "
if [[ $(cmp -s "${tmpDir}/goalStatus.txt" "${tmpDir}/workStatus.txt";echo $?) == 0 ]]
then echo "OK"
else echo "FAIL"
diff -y --color=always *Status.txt
echo
fi
echo -n "INDEX/WORKDIR-FILES - "
if [[ $(cmp -s "${tmpDir}/goalStageFiles.txt" "${tmpDir}/workStageFiles.txt";echo $?) == 0 ]]
then echo "OK"
else echo "FAIL"
diff -y --color=always *StageFiles.txt
echo
fi
echo -n "PUSH/COMMMIT-STATE - "
if [[ $(cmp -s "${tmpDir}/goalPushState.txt" "${tmpDir}/workPushState.txt";echo $?) == 0 ]]
then echo "OK"
else echo "FAIL"
diff -y --color=always *PushState.txt
echo
fi
echo -n "BRANCH-SETUP - "
if [[ $(cmp -s "${tmpDir}/goalBranchSetup.txt" "${tmpDir}/workBranchSetup.txt";echo $?) == 0 ]]
then echo "OK"
else echo "FAIL"
diff -y --color=always *BranchSetup.txt
echo
fi
echo -n "REMOTES - "
if [[ $(cmp -s "${tmpDir}/goalRemotes.txt" "${tmpDir}/workRemotes.txt";echo $?) == 0 ]]
then echo "OK"
else echo "FAIL"
diff -y --color=always *Remotes.txt
echo
fi