[PATCH util/modular] release.sh: adjust for changed git status exit codes.

Dan Nicholson dbn.lists at gmail.com
Tue May 11 16:29:57 PDT 2010


On Tue, May 11, 2010 at 3:43 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. Replace this with a script to parse through the git
> status output (ignoring uncommitted files).
>
> [commit 9e4b7ab652561e1807702fe5288e04b8873fc437
>  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 |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/release.sh b/release.sh
> index c8461fc..a37db95 100755
> --- a/release.sh
> +++ b/release.sh
> @@ -129,8 +129,8 @@ if [ "x$ignorechanges" != "x1" ]; then
>         abort_for_changes
>     fi
>
> -    git status > /dev/null 2>&1
> -    if [ $? -eq 0 ]; then
> +    uncommitted=`git status --porcelain -uno | grep -v "^ M" | wc -l`
> +    if [ $uncommitted -ne 0 ]; then
>         abort_for_changes
>     fi
>     set -e

Figuring "there has to be a better way", I decided to look at how
git-describe decides if the tree is dirty. It uses "git diff-index
--quiet HEAD --", which exits with 1 when there are differences with
HEAD. Looks like this is the same (for our purposes) as "git diff
--quiet HEAD". Might be easier to use that than trying to comb through
status output.

--
Dan


More information about the xorg-devel mailing list