From: Prarit Bhargava <prarit(a)redhat.com>
redhat/Makefile: add dist-assert-tree-clean target
Add dist-assert-tree-clean target that fails whenever staged/unstaged
changes or untracked files are present in the git tree.
Manual invocation of this target is not expected, thus left out of
dist-help. It's intended to act as a guard against any temporary changes
prior to running tooling that could change or revert them.
No checks are performed whenever $FORCE is non-empty.
Signed-off-by: Čestmír Kalina <ckalina(a)redhat.com>
Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -331,6 +331,25 @@ dist-kabi-dup: dist-python-check
fi \
done;
+dist-assert-tree-clean:
+ifeq ($(FORCE),)
+ @if ! git diff-index --quiet --cached HEAD -- &> /dev/null; then \
+ echo "ERROR: staged changes found. Please clean the git tree."; >&2 \
+ git status; \
+ exit 1; \
+ fi
+ @if ! git diff-files --quiet &> /dev/null; then \
+ echo "ERROR: unstaged changes found. Please clean the git tree." >&2;
\
+ git status; \
+ exit 1; \
+ fi
+ @if [ $$(git ls-files --exclude-standard --others | wc -l) -gt 0 ]; then \
+ echo "ERROR: untracked files found. Please clean the git tree." >&2;
\
+ git status; \
+ exit 1; \
+ fi
+endif
+
dist-check-kabi: dist-kabi
@if [ ! -e $(_OUTPUT)/Module.symvers ]; then \
echo "ERROR: You must compile the kernel and modules first";\
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2021