From 2d8fc9a15542ba174ff5e8a7c0185c39a1732db0 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Wed, 27 Jun 2018 17:42:38 -0700 Subject: [PATCH] koji: exit early if spec has uncommitted changes When running 'make koji', the tooling will attempt to create a new git tag with a name constructed from the spec file's NVR. However, if there are uncommitted changes to the Name, Version, or Release fields (collectively, NVR) in that file, the new tag's name will not match the NVR in the spec file referenced by commit HEAD. Protect against the mismatch by exiting early from a 'make koji' if any spec file modifications are not yet committed to the repo, and alert the user what the problem is. Signed-off-by: Patrick McCarty --- Makefile.common | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.common b/Makefile.common index 216b19f..3cd4c3d 100644 --- a/Makefile.common +++ b/Makefile.common @@ -293,6 +293,10 @@ koji: prekoji-checks kojidef echo "Error: Must be on the master branch to submit to koji" >&2; \ exit 1; \ fi; \ + if ! git diff --quiet HEAD ${SPECFILE}; then \ + echo "Error: All changes to ${SPECFILE} must be committed first" >&2; \ + exit 1; \ + fi; \ if git rev-parse --verify --quiet origin/master > /dev/null; then \ git pull --rebase; \ fi