greenpau / caddy-git

Git Plugin for Caddy v2
Apache License 2.0
70 stars 13 forks source link

chore: fix branch not found issue #27

Open siddarthkay opened 1 month ago

siddarthkay commented 1 month ago

Problem Statement

We use caddy-server and caddy-git plugin to host our websites. When our deploy branch changed in our github repo from gh-pages to deploy-master we noticed that caddy-git was unable to update a site when the config change indicated a change in branch name.

The core problem was that the deployed repo folder was missing the branch from the remote origin

Solution

In the event of a failure to update a branch this PR adds a case and validates if the update failed due to a change in branch name and if so we fetch the remote and try to switch the branch to the config. This would ensure the caddy service would not break.