Browse Source

fix(makefile): harden clean worktree check (#6702)

Make check-diff capture porcelain status once,
and fail when git status itself errors (no text in stdout, only stderr).
In that case, stdout empty test is passing, which should not.

Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard+rochepub@external.roche.com>
Jean-Philippe Evrard 1 week ago
parent
commit
f3cb9531ba
1 changed files with 1 additions and 1 deletions
  1. 1 1
      Makefile

+ 1 - 1
Makefile

@@ -84,7 +84,7 @@ reviewable: generate docs manifests helm.generate helm.schema.update helm.docs l
 
 check-diff: reviewable ## Ensure branch is clean.
 	@$(INFO) checking that branch is clean
-	@test -z "$$(git status --porcelain)" || (echo "$$(git status --porcelain)" && $(FAIL))
+	@status="$$(git status --porcelain)" && test -z "$$status" || (printf '%s\n' "$$status" && $(FAIL))
 	@$(OK) branch is clean
 
 update-deps: ## Update dependencies across all modules (root, apis, runtime, e2e, providers, generators)