Re: [PATCH] Trapping exit in tests, using return for errors

2005-08-11 Thread Junio C Hamano
Pavel Roskin [EMAIL PROTECTED] writes: This patch does following: All instances of exit, exit 1 and (exit 1) in tests have been replaced with return 1. In fact, (exit 1) had no effect. Are you sure about all of the above? You are right about ... || exit in the expect_success tests; they

Re: [PATCH] Trapping exit in tests, using return for errors

2005-08-11 Thread Junio C Hamano
Sorry, sent it out without finishing. The worst is return. With ksh, ash, and dash, the script itself exits with status code 1 (presumably you are trapping it with trap -- exit, though). prompt$ bash k.sh exit foo prompt$ bash k.sh false foo status 1 prompt$ bash k.sh return foo k.sh: line 20:

Re: [PATCH] Trapping exit in tests, using return for errors

2005-08-11 Thread Junio C Hamano
Junio C Hamano [EMAIL PROTECTED] writes: Sorry, sent it out without finishing. The worst is return. Ah, my mistake. You have the eval that can eval return in a function and let that return return from that function. Cleverly done. Thanks. - To unsubscribe from this list: send the line

Re: [PATCH] Trapping exit in tests, using return for errors

2005-08-11 Thread Pavel Roskin
Hi, Junio! On Wed, 2005-08-10 at 23:31 -0700, Junio C Hamano wrote: Junio C Hamano [EMAIL PROTECTED] writes: Sorry, sent it out without finishing. The worst is return. Ah, my mistake. You have the eval that can eval return in a function and let that return return from that function.

[PATCH] Trapping exit in tests, using return for errors

2005-08-10 Thread Pavel Roskin
Hello! I have noticed that make test fails without any explanations when the merge utility is missing. I don't think tests should be silent in case of failure. It turned out that the particular test was using exit to interrupt the test in case of an error. This caused the whole test script to