Last 2 commits introduced fatal null-pointer exception when waiting on
HookRunner object when not set, e.g. waiting for WebhookRunner when no
webhook is defined. Fixed bug and got test_e2e.sh to run successfully.
* changed sendCompletedOnceMessageIfApplicable so that it kills thread
after executing
* moved logic for waiting on HookRunner into function defined in
HookRunner itself
Resolved a few issues with e2e tests discovered after running
test_e2d.sh. Just finished setting up Linux (Fedora) environment in
which this script can be run.
- Renamed [x]HookChannel to [x]hookChannel for consistency
- Made hookChannels buffered chanels of size 1
- Added clarifying documentation and renamed functions expalining how I was
- ensuring that hooks execute at least once, assuming that main thread does not crash
- make sure chanels are not written to more than once
Resolved original issue by introducing a boolean chanel by which exechook runner can communicate with main thread.
Then introduced and used webhook executed-at-least-once chanel and added documentation explaining sections of of code
only executed when git-sync pulls for first time.
When git-sync fails to clone the git project, the ssh diagnostic message
is suppressed. It is sometimes helpful for debugging the cloning issue.
One example of the ssh dianostic message is
```
ssh: Could not resolve hostname ${REPO_HOST}: Name or service not known
```
This commit removes the `-q` flag from the ssh command to expose such
message.
No difference in flags. Log output will now be JSON.
example:
{"logger":"","ts":"2021-11-24 11:19:46.340238","caller":{"file":"main.go","line":1031},"level":0,"msg":"cloning repo","origin":"https://github.com/thockin/git-sync","path":"/tmp/gt"}
Make all test cases functions so they can be called individually on the
CLI. Call test_e2e.sh with `-?` to list tests. Fix related crashes
(uses of $TESTCASE and so on).
A new flag `--password-file` is added. This allows git-sync to read
password from file and this is considered as safer than reading from
env or flag directly.
Few more checks are added as well:
1. `--password` and `--password-file` can't be specified at the same
time.
1. If `--username` is specified, then one of `--password` or
`--password-file` must be specified.