git: Fix detection of repos with local changes to stash.
kdesrc-build can get confused about whether a git repository has local
changes or not. This is a problem because if there are no local changes,
but kdesrc-build thinks there were local changes, kdesrc-build will try
to have git stash those local changes. If there is no such change to
stash, git-stash will still succeed, but the later git-stash command to
reverse the operation will fail (because there's no stash to reverse).
This then causes kdesrc-build to fail the update.
The issue, as found and fixed by Bruno Carvalho, is that the
git-status command kdesrc-build uses to see if there are local changes
can output a header even with the --short option passed, if the
status.branch option is set for the user's git configuration.
The fix is to use an underlying facility in git to generate diffs
directly and have git itself return an exit code to flag whether there
are local changes.
Another potential issue which I hope this will fix is that
git-submodules have also been known to confuse kdesrc-build here,
especially with Qt5's qtwebengine. But we'll see.
Differential Revision: https://phabricator.kde.org/D27639