Fix ksb/Updater/Git mislabeling dirty git trees

Authored by brunocarvalho on Feb 25 2020, 5:10 AM.



The git command 'git status --short' is porcelain and may
incorrectly identify clean git trees as dirty if
status.branch git config is set.
Use git-diff-index plumbing instead.

Test Plan

The bug can be reproduced globally for all trees
or locally in just one by setting git config variable
"status.branch" to true. The command "git status --short"
will then print a header with branch tracking information

  • i.e. always print something.

With such a git config, the stashAndUpdate always stashes.
The "git stash push" command for a clean tree succeeds by doing nothing.
Then "git stash pop" command fails because there is nothing to pop.

Diff Detail

R365 kdesrc-build
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
brunocarvalho requested review of this revision.Feb 25 2020, 5:10 AM
brunocarvalho created this revision.

Fix the comment typo

mpyne accepted this revision.Mar 5 2020, 4:11 AM
mpyne added a subscriber: mpyne.

Thanks! This is a much better way to implement this, even if I had found git-diff-index in my search when I was implementing this I'm sure I would have missed the --quiet and --exit-code cmdline options that make this a simple check. Please let me know if you're not able to commit and I will do so instead.

This revision is now accepted and ready to land.Mar 5 2020, 4:11 AM

Hoy! Sorry for the delay. I do not have commit access - please land the commit when you have the time. Thanks!

This revision was automatically updated to reflect the committed changes.