pedroborges / kirby-autogit

⬢ Saves every change made via Kirby Panel to a Git repository
149 stars 23 forks source link

Check if Git repo exists in content folder #21

Closed olach closed 6 years ago

olach commented 7 years ago

I think you need to add a check if there really is a Git repo in the content folder, before the plugin gets activated.

In my case, I want Autogit to be activated only on the live server, not on my local development installation. On my local installation, I have my main Git repo in the root folder that tracks the website, but the content folder is excluded since the client manages the content themselves on the live server.

I tried this plugin as a way to get a version history of the content folder on the live server. This can be useful if the client accidentally deletes a page or some content. If that happens, I can recreate the content from the Git repo.

Since I don't have a .git repo in my local content folder, all commands that the plugin executes, affects my main Git repo in the root folder. This is not good.

One particularly issue, is this: Say I'm working in a different branch than master. As soon as Autogit gets initialized, for example if I refresh a page in the panel or the frontend, Autogit automatically checks out the master branch on my main Git repo.

I haven't found a way to deactivate Autogit through a config setting, but a better way would be if Autogit would check for a Git repo in the content folder before it gets activated. If no Git repo is found in the content folder, then Autogot should not be activated, or maybe just show a message in the widget that a Git repo is missing.

pedroborges commented 7 years ago

Thanks for reporting this issue @olach. I'm working on a new version of Auto Git and will make just this issues doesn't happen.