Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app: project: fix git diff --exit-code logic
Fixes 2020 commit a53ec10 ("west diff: only print output for projects with nonempty diffs") Fixes #731 At least with git version 2.46.0, --exit-code is 0 when there has been a merge conflict! git bug or feature? Either way this causes west diff to wrongly assume there is no diff in that repo. Two other issues: 1. if returncode is higher than 1 (= a git diff failure) AND -v is used, then failed.append(project) is never run. 2. stderr is never, ever printed Try for instance `west diff --fubar` and `west -v --fubar` (which are possible since commit 6aaf248). One fails and the other does not. Neither prints any useful error. The verbosity level should never have any side-effect. To fix: - Assume there is a diff when --exit-code is zero AND stdout is not empty. Treat this the same as --exit-code=1 - Always `failed.append(project)` when --exit-code > 1 - Print stderr when there is a diff or in verbose mode. This drops one `elif` which also simplifies the logic. Signed-off-by: Marc Herbert <marc.herbert@intel.com>
- Loading branch information