Re: [PATCH 1/1] Add the `p4-pre-submit` hook

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



chen bin <chenbin.sh@xxxxxxxxx> writes:

> I updated the patch. But for some reason the test keep failing at this line,
> `test_must_fail git p4 submit --dry-run >errs 2>&1 &&`.
>
> If I change this line to `test_must_fail git-p4 submit --dry-run >errs
> 2>&1 &&` the test will pass.

Hmph.  I somehow suspect that the test also will pass if you changed
it like this:

	test_must_fail false >errs 2>&1 &&

IOW, my suspicion is that the shell fails to find "git-p4" [*1*] and
that is why your `test_must_fail git-p4 whatever` lets your test
pass, which is different from the way you _want_ your test_must_fail
succeed, i.e. "git p4 submit" is run with the "--dry-run" option and
exit with non-zero status.

Of course, if the shell cannot find "git-p4", `errs` would not have
the string "Would apply" in it, so the next test also would pass.

>>>> On 31 July 2018 at 10:46, SZEDER Gábor <szeder.dev@xxxxxxxxx> wrote:
>>>>>> +             test_must_fail git-p4 submit --dry-run >errs 2>&1 &&>
>>>>>> +             ! grep "Would apply" err



[Footnote]

 *1* As I do not use (nor install) p4, I cannot test "'git p4' works
     but 'git-p4' should not work" myself, but by running t0001 with
     a trial patch like the following, you can see that we do not
     find the dashed form `git-init` on $PATH and the test indeed
     fails.

 t/t0001-init.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 0681300707..8c598a0d84 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -31,7 +31,7 @@ check_config () {
 }
 
 test_expect_success 'plain' '
-	git init plain &&
+	git-init plain &&
 	check_config plain/.git false unset
 '
 



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux