Skip to content

Commit b2da600

Browse files
authored
Install: Add uncommitted changes check (#733)
**Why?** In case one were to checkout a tagged release, then make changes, ADF will receive the tagged release number. Instead of tracking the change that was made in the release number as well. By preventing these uncommitted changes, it makes it easier to detect what code is running in a specific version of ADF. So in case someone were to report an issue we can assume the number indicates which version of the code failed. **What?** * Added check for uncommitted changes, these include files that are tracked by the git repository. * Added check for newly created files, these would not be tracked by git yet.
1 parent 67f0032 commit b2da600

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Makefile versions
5-
MAKEFILE_VERSION := 2.2
5+
MAKEFILE_VERSION := 2.3
66
UPDATE_VERSION := make/latest
77

88
# This Makefile requires Python version 3.9 or later
@@ -269,6 +269,26 @@ verify_version: .venv
269269
exit 1 \
270270
) \
271271
)
272+
@# If there are uncommitted changes or new files, this implies that ADF
273+
@# might be modified, hence we should track that in the version number
274+
@( \
275+
git diff-index --quiet HEAD -- src || ( \
276+
echo '' && \
277+
echo '$(CLR_RED)Error: There are uncommitted changes!$(CLR_END)' && \
278+
echo '$(CLR_RED)Please commit these changes first to continue.$(CLR_END)' && \
279+
echo '' && \
280+
exit 1 \
281+
); \
282+
)
283+
@( \
284+
test -z "$$(git ls-files --others --exclude-standard -- src)" || ( \
285+
echo '' && \
286+
echo '$(CLR_RED)Error: New files were added to ADF its source code!$(CLR_END)' && \
287+
echo '$(CLR_RED)Please commit these changes first to continue.$(CLR_END)' && \
288+
echo '' && \
289+
exit 1 \
290+
); \
291+
)
272292
@# If the version number is not a release-tagged version and we are not in a CI build
273293
@( \
274294
if [ "Z$(SRC_VERSION)" != "Z$(SRC_VERSION_TAG_ONLY)" ] && [ "Z$${CI_BUILD}" = "Z" ]; then \

0 commit comments

Comments
 (0)