Earlier we had one folder 'journal_local', when the remote would be
setup a new folder called 'journal' would be created, and each all the
files would be copied over. This meant the local history was being
destroyed.
Now, we only have 1 folder 'journal', and on 'cloning', we add the url
as a remote, and do a git fetch + merge.
This simplifies everything drastically, and opens the door for multiple
remotes.
It makes the entire code base far more complicated and the round trip to
get the directory really isn't that much. This is a massive
micro-optimization for very little benefit.
This way all the persistant state of the app is managed from the same
place. It makes everything much easier. Also, it's required for when
GitJournal supports multiple repositories.
Make it a ChageNotifier and try to access it through the Provider
instead of like a global variable. This way, the state is better
managed and it'll be easier to split out Settings into smaller classes.
It's strange, but this widget routinely gets constructed twice. So
performing a long async operation (generating the ssh key + adding it as
a deploy key) from initState, results in it being called twice. I'm not
sure where the state is initialized twice.
Even adding a unique key to the widget did not help. In the end, I've
just moved the code to its parent widget.
It's easier if there is always at least 1 commit in a repo. Creating a
commit with a .gitignore file was a simple way to ensure that. However,
we can also just check for the presence of any other file. This way, we
avoid the extra commit.