xUnique
xUnique copied to clipboard
sort sections
as #17, I rewrote sort to support sorting sections. This will ease the pain of Xcode reordering sections and causing huge modifications.
@SolaWing hi, sorry for the late reply. Thanks for your PR. As this one is a major change, have you tested on any project file? I think the quick and lazy verification test is to find some complicated project files being xuniqued twice, to see if they were the same without any error exit.
not fully tested, but this PR did solve section sorting problem for my case, without any other side effect @truebit
After the first PR, I also fixed some found problem. The final commit has been used in our team 1 year without any problem.
Maybe we should add auto test?
following is our team's precommithook:
IFS=$'\n' projs=($(git diff --name-only --cached --diff-filter=ACM | grep -o '[a-zA-Z0-9_./]\+\.xcodeproj/project.pbxproj'))
if ((${#projs[@]} > 0)); then
if command -v python3 >/dev/null 2>&1; then
py='python3'
else
py='python'
fi
# set -x
for proj in ${projs[@]}; do
$py xUnique.py -c "$proj";
ret=$?
if (($ret == 100)); then
git add "$proj"
elif (($ret > 0)); then
echo 'xcodeproj file may broken! check the exception message please'
echo 'you may add `--no-verify` option for commit to skip checking xcodeproj'
exit 1
fi
done
if [[ ! $(git diff --name-only --cached | grep -o '[a-zA-Z0-9_./]\+\.xcodeproj/project.pbxproj') ]]; then
echo 'no changes, commit abort'
exit 1
fi
fi
@SolaWing Thanks for the input. auto test is not a very good alternative, as special project files causing problems are normally from private code, those files cannot be included as a testcase 😟