Skip to content

Commit

Permalink
Properly handle staged changes to the version headers
Browse files Browse the repository at this point in the history
Otherwise only the unstaged changes would be preserved.
  • Loading branch information
j4yk committed Mar 11, 2018
1 parent 4627e70 commit 95ac734
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/updateSCCSVersions
Expand Up @@ -31,7 +31,13 @@ if [[ -n "$(git rev-parse --show-toplevel)" ]]; then
fi
versionfiles="platforms/Cross/vm/sqSCCSVersion.h platforms/Cross/plugins/sqPluginsSCCSVersion.h"
git config --local include.path ../.gitconfig
versionfilechanges=$(git diff $versionfiles)
stagedVersionFileChanges=$(git diff --cached $versionfiles)
unstagedVersionFileChanges=$(git diff $versionfiles)
touch $versionfiles
git checkout HEAD -- $versionfiles
test -n "$versionfilechanges" && echo "$versionfilechanges" | git apply
if [[ -n "$stagedVersionFileChanges" ]]; then
echo "$stagedVersionFileChanges" | git apply && git add $versionfiles
fi
if [[ -n "$unstagedVersionFileChanges" ]]; then
echo "$unstagedVersionFileChanges" | git apply
fi

0 comments on commit 95ac734

Please sign in to comment.