[PATCH v2] release.sh: use git-diff --quiet instead of git status

Dan Nicholson dbn.lists at gmail.com
Wed May 12 06:48:52 PDT 2010


On Tue, May 11, 2010 at 5:19 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> git status in git-1.7 always returns 0, regardless of the number of
> uncommitted changes [1]. This breaks the current script. Replace with a git
> diff --quiet HEAD instead, that's sufficient for our use-case here.
>
> [1] commit 9e4b7ab6525 "git status: not "commit --dry-run" anymore"
>    in the git source tree
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  release.sh |    7 +------
>  1 files changed, 1 insertions(+), 6 deletions(-)
>
> diff --git a/release.sh b/release.sh
> index c8461fc..ec52f9a 100755
> --- a/release.sh
> +++ b/release.sh
> @@ -124,15 +124,10 @@ done
>  # Check for uncommitted/queued changes.
>  if [ "x$ignorechanges" != "x1" ]; then
>     set +e
> -    git diff --exit-code > /dev/null 2>&1
> +    git diff --quiet HEAD > /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

Oh, it looks like the status was mostly superfluous anyway. I think if
you just had HEAD after --exit-code before, then you would have also
seen staged changes. Anyway, --quiet (which implies --exit-code) seems
like the right thing to do.

Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>


More information about the xorg-devel mailing list