[PATCH] build.sh: add --gitclean flag.

Peter Hutterer peter.hutterer at who-t.net
Sun Nov 22 15:34:52 PST 2009


git clean -dxfq removes all untracked files, restoring a pristine directory
and exposing build errors due to untracked files.
It's a risky thing to run this one in your normal working tree, git clean -f
is not known for its mercy. It's a good flag to have on a temporary tree
and/or on a tinderbox.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 build.sh |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/build.sh b/build.sh
index ff0e77c..deeeeda 100755
--- a/build.sh
+++ b/build.sh
@@ -174,6 +174,10 @@ build() {
     old_pwd=`pwd`
     cd $SRCDIR || failed cd1 $1 $2
 
+    if [ "x$GITCLEAN" != "x" ]; then
+        git clean -dxfq
+    fi
+
     if test x"$PULL" = x1; then
 	git pull --rebase || failed "git pull" $1 $2
     fi
@@ -711,6 +715,7 @@ usage() {
     echo "  -s sudo-command : sudo command to use"
     echo "  --clone : clone non-existing repositories (uses \$GITROOT if set)"
     echo "  --check : run make check in addition to others"
+    echo "  --gitclean : run git clean -dfqx before building, removes all untracked files"
 }
 
 HAVE_ARCH="`uname -i`"
@@ -753,6 +758,10 @@ do
 	export CFLAGS
 	CONFCFLAGS="CFLAGS=-g3 -O0"
 	;;
+    --gitclean)
+	GITCLEAN=1
+	shift
+	;;
     -h)
 	usage
 	exit
-- 
1.6.5.2


More information about the xorg-devel mailing list