Re: [PATCH v4 1/4] t7503: verify proper hook execution
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 6, 2019, 18:14 UTC
- Message-ID
- <xmqqk1bqjh4s.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <50857290955c5467ef6f75083395c695340fa284.1565044345.git.steadmon@google.com>
Josh Steadmon <steadmon@google.com> writes:
Show 7 quoted lines
> t7503 did not verify that the expected hooks actually ran during > testing. Fix that by making the hook scripts write their $0 into a file > so that we can compare actual execution vs. expected execution. > > While we're at it, do some test style cleanups, such as using > write_script() and doing setup inside a test_expect_success block. > ...
The result mostly looks more pleasant compared to the original, modulo a few nits.
Show 5 quoted lines
> test_expect_success 'with succeeding hook' ' > - > - echo "more" >> file && > + test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && > + ln -s "success.sample" "$PRECOMMIT" &&
Not all systems that want to run Git are capable of symbolic links. We should be able to do a copy here, perhaps? Just the most basic form of "cp" without even "-p" would be sufficient as the target is expected to be missing (i.e. "cp" or "ln -s" would be creating the "$PRECOMMIT"), right?