- # If we're not building for Rawhide then we must use the rightmost
- # (-r) flag so there's an upgrade path to Rawhide.
- rightmost=
- if test %fedora-branch != "rawhide"; then rightmost=-r; fi
-
- # If the specfile doesn't have the magic string then add
- # that now.
- if ! grep -sq %fedora-rebuild-name $specfile; then
- rpmdev-bumpspec -c "- "%fedora-rebuild-name $rightmost *.spec
+ # Add the new commit.
+ if ! grep -sq "^%%autochangelog" $specfile; then
+ # If we're not building for Rawhide then we must use the
+ # rpmdev-bumpspec rightmost (-r) flag so there's an upgrade
+ # path to Rawhide.
+ rightmost=
+ if test %fedora-branch != "rawhide"; then rightmost=-r; fi
+
+ # If the specfile doesn't have the magic string then add
+ # that now.
+ if ! grep -sq %fedora-rebuild-name $specfile; then
+ rpmdev-bumpspec -c "- "%fedora-rebuild-name $rightmost *.spec
+ else
+ rpmdev-bumpspec -c "- Bump release and rebuild" $rightmost *.spec
+ fi
+
+ fedpkg commit -c