142 Commits

Author SHA1 Message Date
a7654fb724 feat: Add a button to export the repo as a zip
This is supposed to create a zip of all the files in the repo, and its
.git folder. It's super useful for debugging the state of the repo, and
it's also useful when the remote is down but you still have changes
which you want to export.
2024-08-17 01:07:38 +02:00
29fd576109 Avoid using git_bindings except for clone/pull/push/ls-remote
Lets use dart-git instead. It seems stable enough, and I'm soon going to
be moving away from libgit2 to go-git anyway. This is the first step towards
that.
2023-12-12 19:59:54 +01:00
88d5cf8713 Upgrade deps + flutter
* Also remove dart_code_metrics
2023-11-25 00:51:25 +01:00
657721adc6 Update dart-git and stop using the Result class
Instead we're going to move back to standard exceptions.

Using a custom Result class has created far far more problems
- The Stacktraces aren't always right
- Sometimes one forgets to check the Result error
- All other exception throwing code needing to be converted to Results
- Non idiomatic Dart code

I think it's better to just go back to exceptions. They have their
problems, but overall, I think it's a better approach.
2023-11-24 14:03:30 +01:00
ca98da4029 Update deps and fix linting issues 2023-01-20 16:14:08 +01:00
ae09b1ba12 Add unawaited or explicitly wait
There are still many cases (over 60) to fix.
2022-02-23 15:15:49 +01:00
dd88bf2cb7 Repo.createFolder: Allow it to fail 2022-01-26 12:01:47 +01:00
e27bfbfaea Repository.moveFolder: Add more tests 2022-01-26 12:01:47 +01:00
6eaae014da NotesFolderFS: Simplify
Avoid passing the FileStorage since the parent already has it
2022-01-26 12:01:47 +01:00
c9a031dd29 moveNote: Add test + fix
Fixes #590
2022-01-26 12:01:47 +01:00
3b2dcd7181 Bump dart-git
Now the repo needs to be explicitly closed. This way, we avoid opening
and closing the packfiles again and again. It results in the "Reading
Git History .." page taking about 40% less time.
2022-01-25 11:41:55 +01:00
26af60e2ce Move domain logic out of a UI class 2022-01-22 10:26:02 +01:00
4219adfc30 RenameDialog: Move logic to Repo class
I want all the domain logic to be in the Repo class, this way it can be
performed over another thread / connection. Also, it's far easier to
test this way.
2022-01-22 10:19:22 +01:00
2e2e371c25 Repository.addNote: Allow it to fail 2022-01-21 21:54:38 +01:00
da5346e0f4 Repository.updateNote: Handle failures
We were silently ignoring them before.
2022-01-21 21:44:01 +01:00
f5ef08fd09 Repository.rename: Fail if the destination exists 2022-01-21 21:29:11 +01:00
36d41b5cb4 Repo: Make io operations explicit
We have our own File class and it gets confusing otherwise.
2022-01-21 21:24:48 +01:00
9251353118 Repository.test: Avoid calling sync + cache in the test
It's not required and makes things harder to debug.
2022-01-21 17:21:15 +01:00
abbfbba961 Add a high level test for renaming a Note
Now that GitJournal is following a redux style, writing tests for the
domain logic is much easier.
2022-01-21 16:27:48 +01:00
83d122d06f Note.oid: The oid is now only empty when the file hasn't yet been saved 2022-01-20 17:51:32 +01:00
b38c97454b Compute the file hash on saving a note
It's not ideal as the hash is now calculated twice, but it simplifies
such a large porition of the code as I can put proper asserts to make
sure all Files in the NotesFolderFS always have a valid GitHash.
2022-01-20 15:43:22 +01:00
143bbf497b Repository: Reload the notes even if not external repo is configured
* This way Note's with a empty GitHash are only present for a short time
* The File Storage Cache is updated regardless
2022-01-20 13:39:58 +01:00
e28c319406 Ensure all editors reset the note's oid 2022-01-20 12:29:13 +01:00
f17542bf89 Mark Note as immutable 2022-01-18 23:34:58 +01:00
7fce95c187 Make Note class immutable
This greatly simplifies the entire data flow. Though, it comes at the
risk of introducing bugs, but I think it's worth it.

Plus, it makes everything far far more testable.
2022-01-18 21:42:56 +01:00
94acf5631d GitAsyncRepo now auto-closes
And avoids spawning a new isolate per operation
2022-01-17 15:21:38 +01:00
abaa20d740 RepoManager: Add helper methods to cleanup invalid repos
Not sure when to use this.
2022-01-14 18:17:09 +01:00
a6eb613b5a Fix note renaming 2022-01-14 17:09:41 +01:00
59c2cc311c Move more logic out of the setup screens 2022-01-13 19:16:28 +01:00
e5b8c942c3 Setup: Move some logic to GJRepo
I would prefer if GJRepo was the only place through which the state was
being changed.
2022-01-13 19:13:02 +01:00
1f6046633b Make sure the GitAsyncRepo is always closed
This is shitty and error prone.
2022-01-13 18:36:59 +01:00
f9271edad3 Upgrade to latest dart-git
Most of dart-git's operations are synchronous by default now. The async
functions run on another isolate.
2022-01-13 18:14:01 +01:00
f820e6eed4 Always check for changes on the desktop
The folder isn't hidden away like on ios/Android by default.
2022-01-07 16:08:35 +01:00
f112c4f9ad Only commit on boot for repos which are stored externally
This commit is very very slow, and slows the entire app down. It might
be acceptable for external repos, given that this will speed up in the
next one, but it anyway doesn't need to be done for internal ones.
2021-12-29 16:50:28 +01:00
566ccc1b53 Autocommit before syncing
This way the user doesn't need to restart the app.
2021-12-29 16:03:01 +01:00
cd959f782a Fix is! operator 2021-12-29 15:13:34 +01:00
f125d8d8a0 GitAutoCommit: Improve the message 2021-12-29 11:51:43 +01:00
f108957bca Auto-commit untracked files on boot 2021-12-29 11:49:05 +01:00
787fd783b7 Reload the FileStorage cache if it is missing items
I'm not sure if this is a good idea as it results in the same Repo being
rebuilt again and again and again.
2021-12-29 11:20:28 +01:00
f70381b56a Avoid storing the GitRepository variable
It's better to open the GitRepository fresh each time. Also, in the
future this GitRepository will have a close method, and will keep some
file descriptors open, so it's important we don't leave it hanging.
2021-12-28 18:00:34 +01:00
81bfd7a777 Rename to rootFolder 2021-12-20 09:28:00 +01:00
f9b4cd58ab Fix linting issues 2021-12-16 13:17:24 +01:00
9d70d53e35 Never just hang on loading
This would happen if the current repo couldn't be opened.

We now show a special "Error Screen", and allow the user to add another
repo.
2021-12-16 13:05:02 +01:00
9fa5b95efe Make the result explicit 2021-12-14 17:04:47 +01:00
d5e57ec0a3 Fix all dart code metrics linter problems
It's now enabled in the CI.
2021-12-14 16:47:58 +01:00
5f8a4d7de3 Repo: Avoid mutable state
The repoFolder can no longer ever be renamed. If it needs to be, then
the GitJournalRepo object, must be reconstructed. This simplifies the
entire code base enourmously, as I can mark tons of variables as 'final'
and I don't need to remember to reinitialize complex dependencies when
the repoPath changes.
2021-12-10 16:02:36 +01:00
81e7cfc93f Repo: Reset the fileStorage on changing the repo path
This is ugly and hacky.
2021-12-10 12:11:57 +01:00
1275820bf9 Show git history building screen after cloning 2021-12-10 11:46:59 +01:00
542fb8c36a Avoid showing the "Reading Git History .." screen
This way startup feels much faster.
2021-12-10 10:57:20 +01:00
8dbf9bc3c4 Improve locking
This way one lock doesn't ever need to wait for a different one.
2021-12-07 12:47:32 +01:00