Re: [PATCH 3/3] bisect: check for mandatory argument of 'bisect replay'

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 3/3] bisect: check for mandatory argument of 'bisect replay'

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:49:46

Christian Couder [off-list ref] writes:
quoted
quoted
 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 rev
I 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 rev
That suggests that the original patch is buggy as well, in that it says
"No logfile given" when it gets two.

How about checking with 1 and saying "Give me only one logfile" and be
done with it?

Re: [PATCH 3/3] bisect: check for mandatory argument of 'bisect replay'

From: Christian Couder <hidden>
Date: 2016-06-15 22:49:47

On Wed, Oct 13, 2010 at 7:58 PM, Junio C Hamano [off-list ref] wrote:
Christian Couder [off-list ref] writes:
quoted
quoted
quoted
 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 rev
I 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 rev
That suggests that the original patch is buggy as well, in that it says
"No logfile given" when it gets two.

How about checking with 1 and saying "Give me only one logfile" and be
done with it?
Yeah or: "Give me exactly one logfile as argument"

Best regards,
Christian.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help