Commit Graph

102 Commits

Author SHA1 Message Date
Nikita Galaiko
ea94ff2c1a more custom error types 2023-10-09 12:05:24 +02:00
Nikita Galaiko
0d82e470ba privatise projects storage 2023-10-06 15:56:43 +02:00
Nikita Galaiko
b57ef8f2c9 privatise users storage 2023-10-06 15:41:45 +02:00
Nikita Galaiko
0d10db2c9b privatise keys storage 2023-10-06 15:25:48 +02:00
Nikita Galaiko
295ace965c feat: refactor zip controller to use new zip module
The zip controller has been refactored to use the new zip module. This change includes updating the import statements and modifying the main function to generate the tauri context with the new zip module.

Additionally, the zip controller now has a new struct called Controller, which contains the necessary fields for handling zip operations. The TryFrom trait has been implemented for the Controller struct to allow for easy creation from the AppHandle.

The main changes include:
- Importing the zip module and updating import statements
- Refactoring the main function to generate the tauri context with the new zip module
- Creating a new Controller struct for handling zip operations
- Implementing the TryFrom trait for the Controller struct to allow for easy creation from the AppHandle
2023-10-06 15:08:42 +02:00
Nikita Galaiko
84e2d8533e pass project repository to gb_repository methods 2023-10-06 12:43:32 +02:00
Nikita Galaiko
08d26ae037 refactor: Update error handling in controller module
The changes in this commit refactor the error handling in the controller module. Instead of using a specific error type for storage errors, the code now uses the `anyhow` crate to handle errors more generically. This simplifies the code and allows for better error handling and reporting.
2023-10-06 08:47:59 +02:00
Nikita Galaiko
83b251b2b4 feat: add users controller to handle user-related operations
The users controller has been added to handle user-related operations such as getting, setting, and deleting user information. This controller is responsible for interacting with the storage module to perform these operations.
2023-10-06 08:40:27 +02:00
Nikita Galaiko
09ac7f1c24 delete extra files 2023-10-05 16:03:41 +02:00
Nikita Galaiko
7e500d5671 fix tests 2023-10-05 16:03:01 +02:00
Nikita Galaiko
73d5ebf823 extract projects controller 2023-10-05 15:44:34 +02:00
Nikita Galaiko
53ed4425f6 feat: add mark_active_session function to update session metadata
The mark_active_session function has been added to the Repository struct. This function updates the last_timestamp_ms field of the current session's metadata to the current system time. This is done to keep track of the last time the session was active.

This function is called in several places where the current session is required to be updated, such as when writing to targets, branches, deltas, bookmarks, and handling git file changes. By updating the session metadata, we ensure that the session remains active and up-to-date.

This change improves the accuracy of session tracking and helps in managing active sessions effectively.
2023-10-05 13:05:18 +02:00
Nikita Galaiko
62d2b7c6fa fix: fix visibility of should_flush function and update test cases for should_flush function 2023-10-05 12:28:37 +02:00
Nikita Galaiko
37e7507e53 chore: refactor projects_storage methods to use consistent naming and simplify code
The changes in this commit refactor the methods in the `projects_storage` module to use consistent naming and simplify the code. The following changes were made:

- Renamed the `update_project` method to `update` in the `projects_storage` module.
- Renamed the `add_project` method to `add` in the `projects_storage` module.
- Renamed the `get_project` method to `get` in the `projects_storage` module.
- Renamed the `list_projects` method to `list` in the `projects_storage` module.

These changes improve code readability and maintainability by using consistent naming conventions and simplifying the method signatures.
2023-10-05 10:04:36 +02:00
Nikita Galaiko
805a23f1b8 fix: fix async handling in App methods
- The `upsert_bookmark` method was not properly handling the async code. It now properly awaits the necessary async operations.
- The `init_project` method now properly handles async code and awaits the necessary async operations.
- The `init` method now properly handles async code and awaits the necessary async operations.
- The `add_project` method now properly handles async code and awaits the necessary async operations.

This ensures that the async operations are properly executed and awaited, preventing potential race conditions or incorrect behavior.
2023-10-05 09:39:45 +02:00
Nikita Galaiko
1ccc204c75 chore: refactor delete_project and update_project functions to be asynchronous 2023-10-05 09:34:51 +02:00
Nikita Galaiko
223cbfaba2 extracts commands mod 2023-10-05 09:28:45 +02:00
Nikita Galaiko
b3902026be refactor: update error handling and repository opening logic in project_repository module 2023-10-05 09:08:42 +02:00
Nikita Galaiko
b2d84362a6 minor fixes 2023-10-05 08:54:13 +02:00
Nikita Galaiko
b81efe9b72 feat: update project path handling to use path::PathBuf instead of String
The previous implementation used a string to represent the project path, which led to potential issues when manipulating paths. The update changes the project path to use the path::PathBuf type, which provides better path manipulation and error handling capabilities. This change improves the overall reliability and maintainability of the code.
2023-10-05 08:44:56 +02:00
Nikita Galaiko
cfafb76a21 add tests for binary registration 2023-10-05 08:25:43 +02:00
Nikita Galaiko
1df251baca chore: remove unused fileGroup function and related code 2023-10-04 16:44:30 +02:00
Nikita Galaiko
b86259b64c chore: remove unused Statuses component and git_status API endpoint 2023-10-04 16:35:06 +02:00
Nikita Galaiko
bb88219933 remove more leftovers 2023-10-04 16:23:32 +02:00
Nikita Galaiko
df32ebfffa chore: remove unused code related to git activity logging 2023-10-04 16:12:55 +02:00
Nikita Galaiko
65a0979649
Merge pull request #1286 from gitbutlerapp/deps-refactor
Deps refactor
2023-10-04 16:07:35 +02:00
Nikita Galaiko
5ba4a9a6b4 drop gb_project's dependency on project_storage 2023-10-04 15:53:00 +02:00
Scott Chacon
e72ef03bc8
Merge pull request #1284 from gitbutlerapp/update-branch-with-upstream
Change upstream branch name
2023-10-04 15:33:53 +02:00
Scott Chacon
7281ed8fdf
🔥 refactor: remove debug statement for remote branch 2023-10-04 15:27:21 +02:00
Scott Chacon
002a52af57
Merge pull request #1285 from gitbutlerapp/Set-user-only-permissions
Set files in data dir to user only (0o600)
2023-10-04 15:23:09 +02:00
Scott Chacon
f225d0aa7f
🐛 fix: set user-only permissions for private key file in Storage::write_file method 2023-10-04 13:59:50 +02:00
Scott Chacon
ccf6136b9a
feat: add Remote Name panel to display and update remote branch name in UI 2023-10-04 13:16:33 +02:00
Nikita Galaiko
6ab278a67c make clippy happy 2023-10-04 12:59:49 +02:00
Nikita Galaiko
f831cb346d refactor: package test initiaion 2023-10-04 12:50:16 +02:00
Nikita Galaiko
13eb5e987e project repository owns project 2023-10-03 15:52:08 +02:00
Nikita Galaiko
550ff26ac7 remove user storage dependency from gb repo 2023-10-03 15:48:49 +02:00
Nikita Galaiko
9faf08e47f
Merge pull request #1279 from gitbutlerapp/Refactor-reader-struct
refactor: use content that is either utf8, large or binary
2023-10-03 12:20:32 +02:00
Nikita Galaiko
f5758371a5 cargo fmt 2023-10-03 12:00:18 +02:00
Nikita Galaiko
30e6026785 fix: pass diff_opts parameter to diff_tree_to_tree function call in trees function 2023-10-03 11:57:39 +02:00
Nikita Galaiko
a0ace30025 implement more From traits for Content 2023-10-03 10:36:43 +02:00
Nikita Galaiko
77bffe638a make git::Blob wrapper 2023-10-03 10:35:43 +02:00
Nikita Galaiko
95304c1968 refactor: use content that is either utf8, large or binary 2023-10-03 10:04:30 +02:00
Kiril Videlov
75bf521bd2 reorder credentials list for performance (if key generated, private_key will fail, so putting it last 2023-09-29 17:14:10 +02:00
Nikita Galaiko
bbbd363870
Merge pull request #1258 from gitbutlerapp/Add-debugging-logs
chore: refactor hunks_by_filepath function to simplify code and impro…
2023-09-29 11:12:13 +02:00
Nikita Galaiko
ea097b7d8b chore: handle errors when converting line content to UTF-8 in hunks_by_filepath function 2023-09-29 11:05:48 +02:00
Nikita Galaiko
644a4ae3f3 chore: refactor hunks_by_filepath function to simplify code and improve readability 2023-09-29 11:02:34 +02:00
Nikita Galaiko
6019f25191 fix: handle both links in and outside the repo 2023-09-29 10:38:52 +02:00
Nikita Galaiko
d77123b775 fix: remove unnecessary steps in creating symlink content
The code previously included unnecessary steps to make the symlink target path relative and convert it to a byte array. These steps have been removed as they are not needed for creating the symlink content.
2023-09-29 09:47:17 +02:00
Nikita Galaiko
110db1bf85 chore: update dependencies and remove sentry-anyhow from Cargo.toml
The changes in this commit update the dependencies in the Cargo.toml file and remove the sentry-anyhow package. The sentry-anyhow package is no longer needed as it has been replaced by the sentry package. This change simplifies the dependencies and ensures that the project is using the latest versions of the required packages.
2023-09-29 09:08:16 +02:00
Nikita Galaiko
7c725a4a9f structured logging 2023-09-29 08:40:21 +02:00