Vanilla-OS / Chronos

Chronos is a simple, fast and lightweight documentation server written in Go.
GNU General Public License v3.0
18 stars 4 forks source link

Overwrite when Git repository is modified #2

Closed nellfs closed 1 year ago

nellfs commented 1 year ago

Currently, when you start a project in Chronos, a folder called articles_repo is created (a clone of the articles repository specified in the configuration file). If the folder already exists, Chronos tries to perform a pull by default.

The problem is that when you change the source repository path in the configuration file, Chronos is not aware of it and attempts to do a pull, but nothing happens. So, if you have new articles (such as an article in another language), Chronos will display the error message "Error populating article cache... no files or directories found." This happens because it didn't clone the new specified repository with the new article.

With this pull request, Chronos checks first if the repository inside the articles_repo folder matches the one specified in the configuration file. If they are different, Chronos will ask if a new clone can be made, overwriting the existing one: "The Git repository has been modified. Do you want to overwrite the current one? (y/n)"