New tags not considered changes
After pulling the repository only a new commit will trigger the then commands
https://github.com/abiosoft/caddy-git/blob/master/git.go#L81
This behaviour prevents to check commit coverage by signed tags if the tags were added later on. To understand my use case: https://carmebar.github.io/2016/10/29/making-a-mirror-of-a-gitbased-blog.html#preparing-caddy
I propose to check for a change in tags too.
Thanks for your work.
Hi, do you have a workaround for this yet ?
Got busy and couldn't really look at issues all this while.
This issue only applies if a signed/annotated tag has been pushed without a commit. That's not very common but to solve it I patched that line: https://github.com/abiosoft/caddy-git/blob/master/git.go#L81 Adding a check for r.fetchLatestTag() == latestTag.
But I'm afraid that it will only check the tag name. Hash should be checked. I haven't looked too much into the source code but seems that in line: https://github.com/abiosoft/caddy-git/blob/master/git.go#L270 --abbrev=0 should be replaced by --long.
I could prepare a pull request sometime next week if you feel like this needs to be addressed and don't have the time to patch yourself.
Thanks again for your work.
I will definitely appreciate a pull request.
Thanks.
After giving it some more thought I've came up with a workaround.
If you set branch {latest} in the configuration the extension will always checkout the newest tag and then will execute the command.
This solves my problem of having unsigned commits without coverage. Won't solve it if a commit is pushed and it's not followed by a new tag. I just need to remember to add new tag after each commit. That will work for my use case.
I don't see a way of updating the current codebase without adding new config options or risking breaking someone's assumption that then will only run command after new commit.
The documentation seems a bit broad about when the command gets executed:
command is a command to execute after successful pull;
'successful pull' should be reworded to state that command will be executed only if there has been a new commit [in the current branch] or there's a new tag (if branch {latest}).
Let me know if you think there's a way to improve the command execution capabilities that fits the middleware's philosophy. I'm more than happy to prepare a pull request.
This issue has been resolved on my end. Sorry for the long text.