Hello,
I am trying to create a pre-commit hook that will gather up all changes in a push and send them off to a remote server for validation.
The code is here https://github.com/Skatteetaten/bitbucket-precommit-hook-boober-validate/blob/master/src/main/java/no/skatteetaten/aurora/bitbucket/hook/BooberVerifyer.java
The version of bitbucket server it is going to run on is 5.4.0
When I run this with atlas-debug -u 6.3.7 i get the following error message on a push:
[INFO] com.atlassian.bitbucket.content.NoSuchPathException: The path "foo.json" does not exist at revision "3c22f6cdefdeaef5694dcbd83c3dc6e75703f301"
...
[INFO] at no.skatteetaten.aurora.bitbucket.hook.BooberVerifyer.lambda$null$2(BooberVerifyer.java:42)
If you look in my repository in git that i push from:
> git show 3c22f6cdefdeaef5694dcbd83c3dc6e75703f301
commit 3c22f6cdefdeaef5694dcbd83c3dc6e75703f301 (HEAD -> master)
Author: Bjarte Stien Karlsen <bjarte.karlsen@skatteetaten.no>
Date: Sun Oct 29 00:58:46 2017 +0200
foo
diff --git a/foo.json b/foo.json
index b343dfb..1b67eb3 100644
--- a/foo.json
+++ b/foo.json
{
- "foo" : "ban"
+ "foo" : "baz"
}
What am I doing wrong? Or is there another easier way of doing this?
The hook is basically going to verify that only json files can be added and they have to be valid. It would also be nice if It could show a hint in a PR if that PR is valid.