adessoSE / jekyll2cms

Tool for exporting github repo to a CMS
https://www.adesso.de
MIT License
3 stars 3 forks source link

RepoService shouldn't be stateful #64

Closed thombergs closed 7 years ago

thombergs commented 7 years ago

Currently, the RepoService has a field oldHead which stores the old Head of the local repository. A Service shouldn't hold state like this. If the application restarts, the state is lost, what happens then?

Instead, the application should store the commit id or commit date of the latest commit in a file and push that file into the repository. Then, when the repo is updated, it could access the old state by reading this file.

Calle-Lo commented 7 years ago

I deleted the field oldHead and create a JSON-File to store the state of the local repository. The JSON-File hold the Commit Informations like the Name and the Email of the Commiter, the Time of the Commit and the Commit-ID.

Due to this Information the Application can get the Head of the latest Commit and look for Updates in the Repository. Jekyll2cms compares the state of the JSON-File with the Information of the Pull. If both have different Information then the Repository need to be updated else there is no update available.

Calle-Lo commented 7 years ago

The static field HEAD was deleted too.