# Possible bug in 'git status' exit code is 1 instead of 0

5 messages from 2007-01-09 to 2007-01-09. Participants: Marco Costalba, Junio C Hamano.
Thread: https://gitlist.dev/t/6309

## Marco Costalba, 2007-01-09 17:45

Subject: Possible bug in 'git status' exit code is 1 instead of 0
Message-ID: <e5bfff550701090945u5a240fe9xf46cc40b030e1ba7@mail.gmail.com>
URL: https://gitlist.dev/e/e5bfff550701090945u5a240fe9xf46cc40b030e1ba7%40mail.gmail.com

```
bash-3.1$ pwd
/home/marco/programmi/git
bash-3.1$ git status; echo $?
# On branch refs/heads/origin
nothing to commit (use "git add file1 file2" to include for commit)
1
bash-3.1$ git --version
git version 1.5.0.rc0.g244a7

```

## Junio C Hamano, 2007-01-09 18:12

Subject: Re: Possible bug in 'git status' exit code is 1 instead of 0
Message-ID: <7vhcv0m5md.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vhcv0m5md.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <e5bfff550701090945u5a240fe9xf46cc40b030e1ba7@mail.gmail.com>

```
"Marco Costalba" <mcostalba@gmail.com> writes:

> bash-3.1$ pwd
> /home/marco/programmi/git
> bash-3.1$ git status; echo $?
> # On branch refs/heads/origin
> nothing to commit (use "git add file1 file2" to include for commit)
> 1
> bash-3.1$ git --version
> git version 1.5.0.rc0.g244a7

I think that's normal and has been the way for git-commit to
detect if there is anything to commit.

```

## Marco Costalba, 2007-01-09 18:33

Subject: Re: Possible bug in 'git status' exit code is 1 instead of 0
Message-ID: <e5bfff550701091033x51496b38x6c6f798e8a7ae795@mail.gmail.com>
URL: https://gitlist.dev/e/e5bfff550701091033x51496b38x6c6f798e8a7ae795%40mail.gmail.com
In-Reply-To: <7vhcv0m5md.fsf@assigned-by-dhcp.cox.net>

```
On 1/9/07, Junio C Hamano <junkio@cox.net> wrote:
> "Marco Costalba" <mcostalba@gmail.com> writes:
>
> > bash-3.1$ pwd
> > /home/marco/programmi/git
> > bash-3.1$ git status; echo $?
> > # On branch refs/heads/origin
> > nothing to commit (use "git add file1 file2" to include for commit)
> > 1
> > bash-3.1$ git --version
> > git version 1.5.0.rc0.g244a7
>
> I think that's normal and has been the way for git-commit to
> detect if there is anything to commit.
>
>

Ok, I was changing the error detection to check exit status, but it's
definitely better to still check for something written to stdErr
instead.

Thanks
Marco

```

## Junio C Hamano, 2007-01-09 18:50

Subject: Re: Possible bug in 'git status' exit code is 1 instead of 0
Message-ID: <7vslekkpav.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vslekkpav.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <e5bfff550701091033x51496b38x6c6f798e8a7ae795@mail.gmail.com>

```
"Marco Costalba" <mcostalba@gmail.com> writes:

> Ok, I was changing the error detection to check exit status, but it's
> definitely better to still check for something written to stdErr
> instead.

Non-zero status to indicate there is nothing to commit has
always been the way for git-status to report since the very
first edition of the command (a3e870f2, May 30 2005), so you
should be able to depend on it.

```

## Marco Costalba, 2007-01-09 20:47

Subject: Re: Possible bug in 'git status' exit code is 1 instead of 0
Message-ID: <e5bfff550701091247n67b8d080oe804320453114d04@mail.gmail.com>
URL: https://gitlist.dev/e/e5bfff550701091247n67b8d080oe804320453114d04%40mail.gmail.com
In-Reply-To: <7vslekkpav.fsf@assigned-by-dhcp.cox.net>

```
On 1/9/07, Junio C Hamano <junkio@cox.net> wrote:
> "Marco Costalba" <mcostalba@gmail.com> writes:
>
> > Ok, I was changing the error detection to check exit status, but it's
> > definitely better to still check for something written to stdErr
> > instead.
>
> Non-zero status to indicate there is nothing to commit has
> always been the way for git-status to report since the very
> first edition of the command (a3e870f2, May 30 2005), so you
> should be able to depend on it.
>

Thanks, but what I was trying to find was a reliable way to know, from
qgit side, when a launched external program failed. This should apply
to git commands of course but also to others, as example StGit or bash
ones (ls, cd, etc..).

So the rule should be general enough. Now the rule is to test for the
presence of any message in stdError _or_  for a special Qt flag set,
that is useful to know if the application crashed or terminated
abruptly.

I think I will stick with that because this error detect framework
should stay command agnostic.

 Marco

```
