Re: [PATCH v4 1/7] bisect--helper: reimplement `bisect_log` shell function in C
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jan 30, 2021, 09:49 UTC
- Message-ID
- <CAP8UFD0iZ5WMMV8FZgNx9jFV9W4qMMPXMEN-ExG8jOkw9LLH6g@mail.gmail.com>
- In-Reply-To
- <YBS6YJq0W3VsGf6P@danh.dev>
On Sat, Jan 30, 2021 at 2:46 AM Đoàn Trần Công Danh <congdanhqx@gmail.com> wrote:
Show 12 quoted lines
> > @@ -210,7 +205,7 @@ case "$#" in > > replay) > > bisect_replay "$@" ;; > > log) > > - bisect_log ;; > > + git bisect--helper --bisect-log || exit ;; > > The original code was "die" when no bisect_log available. > > I think we need to "exit 1" here to indicate a failure, i.e. > > git bisect--helper --bisect-log || exit 1 ;;
Actually:
git bisect--helper --bisect-log || exit ;;
will indicate failure. See:
$ ( false || exit ) $ echo $? 1
The difference with what you suggest is that the exit code will be the same instead of always 1:
$ ( ( exit 4 ) || exit ) echo $? 4
which is a good thing, as die() exits with code 128, so if `git bisect--helper --bisect-log` die()s then we will get a 128 exit code with `|| exit` instead of 1 with `|| exit 1`.
Thanks for your review, Christian.