Re: [PATCH 3/3] bisect: check for mandatory argument of 'bisect replay'
- From
Christian Couder <chriscool@tuxfamily.org>
- Date
- Oct 12, 2010, 02:56 UTC
- Message-ID
- <201010120456.35411.chriscool@tuxfamily.org>
- In-Reply-To
- <201010120435.11903.chriscool@tuxfamily.org>
On Tuesday 12 October 2010 04:35:11 Christian Couder wrote:
Show 41 quoted lines
> On Sunday 10 October 2010 23:48:58 SZEDER Gábor wrote:
> > 'git bisect replay' has a mandatory logfile argument, but the current
> > implementation doesn't check whether the user has specified one. When
> > the user omits the logfile argument, this leads to the following
> >
> > unhelpful error message:
> > cannot read for replaying
> >
> > So, check for the mandatory argument first, and provide a more
> > meaningful error message when it is omitted.
> >
> > Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
> > ---
> >
> > git-bisect.sh | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/git-bisect.sh b/git-bisect.sh
> > index 68fcff6..c21e33c 100755
> > --- a/git-bisect.sh
> > +++ b/git-bisect.sh
> > @@ -343,6 +343,7 @@ bisect_clean_state() {
> >
> > }
> >
> > bisect_replay () {
> >
> > + test "$#" -eq 1 || die "No logfile given"
> >
> > test -r "$1" || die "cannot read $1 for replaying"
> > bisect_reset
> > while read git bisect command rev
>
> While at it perhaps you could do something like:
>
> bisect_replay () {
> + test "$#" -lt 1 || die "No logfile given"
> + test "$#" -gt 1 || die "Too many argument. Please give only one logfile."
> test -r "$1" || die "cannot read $1 for replaying"
> bisect_reset
> while read git bisect command revI mean:
bisect_replay () {
+ test "$#" -lt 1 && die "No logfile given"
+ test "$#" -gt 1 && die "Too many argument. Please give only one logfile."
test -r "$1" || die "cannot read $1 for replaying"
bisect_reset
while read git bisect command revSorry!
Best regards, Christian.