[PATCH] release.sh: abort if local changes are detected.

Peter Hutterer peter.hutterer at who-t.net
Wed Jul 29 18:35:48 PDT 2009


If 'git diff' or 'git status' detect local changes, abort.
This check can be skipped with the --ignore-local-changes option.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 release.sh | 29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/release.sh b/release.sh
index 9f7358d..71efa72 100755
--- a/release.sh
+++ b/release.sh
@@ -19,9 +19,19 @@ Options:
 --force force overwritting an existing release
 --user <name> username on $host_people (default "`whoami`")
 --help this help message
+ --ignore-local-changes don't abort on uncommitted local changes
 HELP
 }
 
+abort_for_changes()
+{
+ cat <<ERR
+Uncommitted changes found. Did you forget to commit? Aborting.
+Use --ignore-local-changes to skip this check.
+ERR
+ exit 1
+}
+
 gen_announce_mail()
 {
 case "$tag_previous" in
@@ -81,6 +91,10 @@ while [ $# != 0 ]; do
 	user=1ドル
 	shift
 	;;
+ --ignore-local-changes)
+ ignorechanges=1
+ shift
+ ;;
 --*)
 echo "error: unknown option"
 usage
@@ -100,6 +114,21 @@ while [ $# != 0 ]; do
 esac
 done
 
+# Check for uncommitted/queued changes.
+if [ "x$ignorechanges" != "x1" ]; then
+ set +e
+ git diff --exit-code > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ abort_for_changes
+ fi
+
+ git status > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ abort_for_changes
+ fi
+ set -e
+fi
+
 tarball_dir="$(dirname $(find . -name config.status))"
 module="${tag_current%-*}"
 if [ "x$module" = "x$tag_current" ]; then
-- 
1.6.3.rc1.2.g0164.dirty


More information about the xorg-devel mailing list

AltStyle によって変換されたページ (->オリジナル) /