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

Peter Hutterer peter.hutterer at who-t.net
Tue May 11 17:12:25 PDT 2010


On Tue, May 11, 2010 at 04:29:57PM -0700, Dan Nicholson wrote:
> 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.

oh, right. for this use-case this makes sense. I just tried to remember why
we had the different git diff and git status stuff - this feature stems from
some local script for me where I have to differ between unstaged and staged
uncommitted changes. So yes, I guess we could just use git diff here. will
send a follow-up in a minute.
 
Cheers,
  Peter


More information about the xorg-devel mailing list