Commit Graph

405 Commits

Author SHA1 Message Date
Nikita Galaiko
a20963def2 rewrite git diff printing 2023-10-17 09:20:15 +02:00
Nikita Galaiko
9dbf36f8f9 correctly handle multiple empty file diffs 2023-10-16 16:36:14 +02:00
Nikita Galaiko
d75d60e36d emit events for empty files 2023-10-16 16:35:57 +02:00
Nikita Galaiko
3a85984e51 remove debug logs 2023-10-16 15:34:19 +02:00
Nikita Galaiko
c896d2b8f2 correctly handle empty file diffs 2023-10-16 15:30:24 +02:00
Nikita Galaiko
3e575482a9 fixup 2023-10-16 15:15:29 +02:00
Nikita Galaiko
9f83b61b2b move more apply branch tests to integration 2023-10-16 14:44:09 +02:00
Nikita Galaiko
10adaa4593 do not use project_repository index while flushing 2023-10-16 13:25:42 +02:00
extrawurst
ae3a6f3ebe
feat: add flush_vbranches method to Controller struct (#1383)
* feat: add flush_vbranches method to Controller struct

The `flush_vbranches` method has been added to the `Controller` struct. This method allows flushing virtual branches as a tree for a specific project. It iterates over the virtual branches of the project and calls the `flush_vbranch_as_tree` function to flush each virtual branch. This method is used in the `Handler` struct to flush virtual branches for a project before flushing the session.

* cleanup error handling

* make controller async for consistency and block on the caller site
2023-10-16 11:18:01 +00:00
Nikita Galaiko
008d7e7236 revert alternates remove 2023-10-16 13:09:07 +02:00
Nikita Galaiko
228224f170 cargo fmt 2023-10-16 12:29:46 +02:00
Nikita Galaiko
bf9d9d499d don't reference alternate odb when flushing session 2023-10-16 12:10:49 +02:00
Kiril Videlov
d6edbc2187 🔧 fix: update connect-src CSP directive to include api.github.com for additional API endpoint access 2023-10-16 09:35:06 +02:00
Kiril Videlov
53116d4740 🔧 fix: add Content Security Policy (CSP) for dev mode too 2023-10-14 20:03:23 +02:00
Kiril Videlov
53186737d5 🔧 fix: update CSP img-src to allow loading images from GitHub avatars 2023-10-14 20:03:00 +02:00
Nikita Galaiko
cff22fbc66 fixup 2023-10-13 15:54:16 +02:00
Nikita Galaiko
de4942c945 fix clippy in tests 2023-10-13 15:33:18 +02:00
Nikita Galaiko
04b9f7bd8b
Merge pull request #1364 from gitbutlerapp/Add-id-module
Add id module
2023-10-13 13:14:01 +02:00
Nikita Galaiko
b9b14bb921 resolve conflicts 2023-10-13 13:07:30 +02:00
Nikita Galaiko
45daddeaa3 more clippy fixes 2023-10-13 12:56:33 +02:00
extrawurst
9ead8a6133 align the context/error handling add_disk_alternate 2023-10-13 12:50:59 +02:00
Nikita Galaiko
8accaa1fec typed virtual branch id 2023-10-13 12:50:05 +02:00
extrawurst
71010d24f7
extract tree flushing to reuse in flush_session (#1357) 2023-10-13 12:01:16 +02:00
extrawurst
cf1bdabc82 update a bunch of crates, leaving tantivy for now as it breaks the build 2023-10-13 11:38:01 +02:00
Nikita Galaiko
a589b934a2 clippy fixes 2023-10-13 11:07:38 +02:00
Nikita Galaiko
00a631fd2d merge upstream 2023-10-13 11:03:16 +02:00
Nikita Galaiko
276e2d5b4f typed project id 2023-10-13 11:00:00 +02:00
Nikita Galaiko
6cac02fccc typed session ids 2023-10-13 09:48:24 +02:00
extrawurst
885a69f8f0
check if the config allows for cloud sync (#1352)
* check sync config at places of triggers and only error out in fetch if sync is off and fetch event was triggered
* added tests
2023-10-12 18:46:49 +02:00
Nikita Galaiko
8a19c3550e type assert 2023-10-12 15:45:29 +02:00
Nikita Galaiko
cba2d2fc4f hide some methods under #cfg(test) 2023-10-12 15:35:50 +02:00
Nikita Galaiko
878c23c229 remove duplicated tests 2023-10-12 15:14:02 +02:00
Nikita Galaiko
93d8128301 better tests for conflict resolution 2023-10-12 15:07:43 +02:00
Nikita Galaiko
5bd549f22c detect conflict resolution while comitting 2023-10-12 15:07:14 +02:00
Nikita Galaiko
2700be6b50 virtual branches conflict test 2023-10-12 14:25:01 +02:00
extrawurst
fe64ae9db7 fix tests 2023-10-12 11:23:19 +02:00
extrawurst
dd8977a588 write objects path to gb repos alternates file 2023-10-12 11:09:39 +02:00
Nikita Galaiko
3366f24384
Merge pull request #1348 from gitbutlerapp/init-integrations-tests
assert error types instead of messages
2023-10-12 11:05:45 +02:00
Nikita Galaiko
3a397c110f assert error types instead of messages 2023-10-12 10:59:52 +02:00
Nikita Galaiko
8dd6c74e00
Merge pull request #1347 from gitbutlerapp/Virtual-branch-2
move tempfile to dev-dependencies
2023-10-12 10:56:20 +02:00
Nikita Galaiko
cc912997d6 sort deps 2023-10-12 10:48:57 +02:00
Nikita Galaiko
92e28f7588 move tempfile to dev-dependencies 2023-10-12 10:44:49 +02:00
Nikita Galaiko
a71baaacb0 init integration tests 2023-10-12 10:36:48 +02:00
Nikita Galaiko
bf65ec2d98 handle remote is set but not pushed 2023-10-12 08:16:43 +02:00
Nikita Galaiko
a5d898182a
Merge pull request #1342 from gitbutlerapp/force-pushing 2023-10-11 16:01:07 +02:00
extrawurst
5e186b580c
add and fix clippy::restrictions lints (#1341)
left a few as TODO which make sense but pose too much refactoring right now
2023-10-11 15:14:54 +02:00
Nikita Galaiko
ce3bd1521c use force push when needed 2023-10-11 15:09:04 +02:00
Nikita Galaiko
f7916c7907 add requires_force calculation for vbranch 2023-10-11 14:33:01 +02:00
Nikita Galaiko
be86302d6b merged upstream (head only) 2023-10-11 14:14:44 +02:00
Nikita Galaiko
e6c5ddfbb4
Merge pull request #1340 from gitbutlerapp/Add-empty-bare-repository-function
use a real (though local) remote repository for tests
2023-10-11 14:14:32 +02:00
Nikita Galaiko
36e3a120d6 add missing import 2023-10-11 14:08:59 +02:00
Nikita Galaiko
7bf0252269 add init_bare to repository 2023-10-11 14:02:18 +02:00
Nikita Galaiko
5209ee05a2 fixup 2023-10-11 13:57:48 +02:00
Nikita Galaiko
e3d43eb874 use a real (though local) remote repository for tests 2023-10-11 13:56:46 +02:00
extrawurst
856f9b73c1
Merge pull request #1337 from gitbutlerapp/go-full-on-clippy
enable more clippy lints and allow a few that would make our life muc…
2023-10-11 13:27:19 +02:00
Nikita Galaiko
73fa6e9c90 correctly return git fetch errors 2023-10-11 12:47:52 +02:00
Nikita Galaiko
0e1be9d25f correctly return git push errors 2023-10-11 12:47:52 +02:00
Nikita Galaiko
4c62849906 revert check for conflicts before commit creation 2023-10-11 12:05:48 +02:00
extrawurst
2ecf57e75a enable more clippy lints and allow a few that would make our life much harder, allow also some that need more careful review (number casts) 2023-10-11 11:29:41 +02:00
extrawurst
91303d9bf4
Merge pull request #1330 from gitbutlerapp/deny-unsafe-code
make sure clippy does not allow us to use unsafe
2023-10-11 10:38:43 +02:00
Nikita Galaiko
058b8bc70e
Merge pull request #1333 from gitbutlerapp/Refactor-init-device-oauth
fix: handle errors properly in init_device_oauth and check_auth_statu…
2023-10-11 10:38:14 +02:00
Kiril Videlov
b968c2cedd fix incorrect csp list 2023-10-11 10:37:07 +02:00
extrawurst
b480902bf5 remove all unsafe usage and forbid it moving forward 2023-10-11 10:34:49 +02:00
Nikita Galaiko
2b47ed10bb
Merge branch 'master' into Refactor-init-device-oauth 2023-10-11 10:32:39 +02:00
Nikita Galaiko
7a145d2450 should be possible to commit during conflict 2023-10-11 10:26:16 +02:00
extrawurst
f69029247e fix conflicts 2023-10-11 10:18:28 +02:00
extrawurst
bd10d3bb98
Merge pull request #1334 from gitbutlerapp/fix-some-warnings
refactor: remove unused imports
2023-10-11 10:05:22 +02:00
Nikita Galaiko
2d85b25005
Merge pull request #1329 from gitbutlerapp/Reset-branch-to-specific-commit
Reset branch to specific commit
2023-10-11 10:04:32 +02:00
Nikita Galaiko
1b12bfb3f3 cargo fmt 2023-10-11 10:04:07 +02:00
extrawurst
d8fc07f81f refactor: remove unused imports 2023-10-11 09:57:24 +02:00
extrawurst
fff7ae7fd2
Merge pull request #1331 from gitbutlerapp/more-clippy-lints
more clippy lints and the according fixes
2023-10-11 09:55:43 +02:00
Nikita Galaiko
a08c6d7ce7
Merge pull request #1297 from gitbutlerapp/dependabot/cargo/reqwest-0.11.22
chore(deps): bump reqwest from 0.11.20 to 0.11.22
2023-10-11 09:55:25 +02:00
Nikita Galaiko
41473864b5
Merge pull request #1305 from gitbutlerapp/dependabot/cargo/sha1-0.10.6
chore(deps): bump sha1 from 0.10.5 to 0.10.6
2023-10-11 09:54:46 +02:00
Nikita Galaiko
09526fdde6 fix: handle errors properly in init_device_oauth and check_auth_status functions
- Previously, the functions `init_device_oauth` and `check_auth_status` did not properly handle errors when sending requests and parsing response bodies.
- This commit updates the error handling in both functions to provide more informative error messages and properly propagate errors.
- Now, if there is an error sending the request or parsing the response body, the functions will return an `Error::Unknown` error with the appropriate context.
- This improves the reliability and error reporting of the login functionality in the client application.
2023-10-11 09:52:49 +02:00
extrawurst
af6c6c17bb merged upstream 2023-10-11 09:52:43 +02:00
extrawurst
2e9f26e3cd merged upstream 2023-10-11 09:52:36 +02:00
extrawurst
fecafc834b
Merge pull request #1328 from gitbutlerapp/GB-609-gitbutlerjson
GB-609: create/update `.git/gitbutler.json`
2023-10-11 09:51:03 +02:00
Nikita Galaiko
116953fbf1 merged upstream 2023-10-11 08:38:46 +02:00
Kiril Videlov
79f473e807 🔨 chore: move github module to correct location in module list 2023-10-10 19:18:44 +02:00
Kiril Videlov
698fb012e8 support for github device oauth flow 2023-10-10 19:18:44 +02:00
extrawurst
2acf7f36ea more clippy lints and the according fixes 2023-10-10 17:39:13 +02:00
extrawurst
5fa412b857 make sure clippy does not allow us to use unsafe 2023-10-10 17:14:36 +02:00
extrawurst
251f78e1bf remove unused method 2023-10-10 17:11:05 +02:00
extrawurst
6632a1b70b feat: add test for gitbutler file creation and content verification 2023-10-10 16:36:07 +02:00
Nikita Galaiko
738d1bfceb add a test button 2023-10-10 14:52:16 +02:00
Nikita Galaiko
1857e991aa expose reset virtual branch command 2023-10-10 14:20:49 +02:00
Nikita Galaiko
8ebd529d55 feat: add support for tracking upstream head commit in virtual branches
The changes in this commit add support for tracking the upstream head commit in virtual branches. This is done by introducing a new field `upstream_head` in the `Branch` struct. The `upstream_head` field represents the last commit that has been pushed to the upstream branch.

The following changes were made:
- Added `upstream_head` field to the `Branch` struct
- Updated the `create_virtual_branch` function to initialize the `upstream_head` field as `None`
- Updated the `push` function to set the `upstream_head` field to the current head commit of the virtual branch
- Updated the `create_virtual_branch_from_branch` function to initialize the `upstream_head` field as `None`
- Updated the `BranchWriter` struct to write the `upstream_head` field to the branch metadata
- Updated the `TryFrom<&dyn crate::reader::Reader>` implementation
2023-10-10 14:13:21 +02:00
Nikita Galaiko
1721e9046f feat: reset virtual branch 2023-10-10 14:10:24 +02:00
extrawurst
571e61e2e0 GB-609: create/update .git/gitbutler.json
this happens when a new session is created
2023-10-10 13:34:03 +02:00
extrawurst
d3b356c3a9 cleanup clippy warning 2023-10-10 12:42:15 +02:00
Nikita Galaiko
00543d15ee introduce dataDir to git file change handler 2023-10-10 12:24:14 +02:00
extrawurst
ffda438143
Merge pull request #1316 from gitbutlerapp/Add-gb-flush-command
GB-610: flush session if GB_FLUSH file triggers watcher
2023-10-10 12:21:09 +02:00
extrawurst
f535ba30d5 trigger flush_session if GB_FLUSH file triggers watcher git event
* remove GB_FLUSH after processing it
* add test for flushing and deleting flush file
* add more unittests for cases:
 * no session, file -> no flush, file deleted
 * session, file -> flush, file deleted
 * session, no file -> no flush
2023-10-10 12:03:06 +02:00
Nikita Galaiko
69e9d08501 feat: update set_user function to return the updated user object
The `set_user` function in the client code has been updated to return the updated user object after setting it in the app. This change allows for better handling of the user object and enables further operations on it if needed. The updated function now returns a `Result<User, Error>` instead of `Result<(), Error>`.
2023-10-10 10:31:20 +02:00
Nikita Galaiko
e672fb7fbf define types for local app dir and logs dir 2023-10-10 09:21:47 +02:00
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
dependabot[bot]
0a20c2de00
chore(deps): bump sha1 from 0.10.5 to 0.10.6
Bumps [sha1](https://github.com/RustCrypto/hashes) from 0.10.5 to 0.10.6.
- [Commits](https://github.com/RustCrypto/hashes/compare/sha1-v0.10.5...sha1-v0.10.6)

---
updated-dependencies:
- dependency-name: sha1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-05 08:46:44 +00:00
dependabot[bot]
0b893c6b3b
chore(deps): bump reqwest from 0.11.20 to 0.11.22
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.20 to 0.11.22.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.20...v0.11.22)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-05 08:44:02 +00:00
Nikita Galaiko
7d245f6f59 chore: update versions of @tauri-apps/cli and related packages to 1.5.1 2023-10-05 10:31:51 +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
Nikita Galaiko
fb4fb7ad06 improve sentry integration 2023-09-29 08:11:03 +02:00
Nikita Galaiko
8ac716e44b fix allowlist 2023-09-28 14:27:49 +02:00
Nikita Galaiko
80f43ffe32 chore: update build scripts to include separate build commands for nightly and development modes 2023-09-28 13:31:40 +02:00
Nikita Galaiko
e3415c0b6b fix: hunk equiality 2023-09-27 12:02:30 +02:00
Nikita Galaiko
61544a003c feat: add ability to unapply ownership for a hunk in the client
The changes in this commit add support for unapplying ownership for a hunk in the client. This allows users to discard changes made to a specific hunk and revert it back to its original state. The unapplyHunk method is added to the BranchController class, which sends a request to the server to unapply the ownership of the hunk. Upon successful unapplying, the virtual branch store is reloaded to reflect the changes.
2023-09-27 10:23:53 +02:00
Nikita Galaiko
114e4135ee
Merge pull request #1245 from gitbutlerapp/add-test-for-parse-ownership-tricky-file-name
fix: improve parsing of ownership ranges in FileOwnership struct
2023-09-26 14:23:15 +02:00
Nikita Galaiko
bbeadd0c8d fix: improve parsing of ownership ranges in FileOwnership struct
The parsing logic for ownership ranges in the `FileOwnership` struct has been improved. Previously, it split the input string by ':' and then by ',' to extract the file path and ranges. However, this approach had issues with file paths containing ':' characters. 

The updated logic now iterates over the parts of the input string in reverse order. If a part can be parsed as a `Hunk` (range), it is added to the `ranges` vector. Otherwise, it is considered as part of the file path and added to the `file_path_parts` vector. Finally, the `file_path_parts` vector is joined with ':' to form the file path.

This change ensures that file paths containing ':' characters are correctly parsed, allowing for more flexible and accurate parsing of ownership ranges.
2023-09-26 14:18:40 +02:00
Nikita Galaiko
c7a86f2039 unapply ownership api 2023-09-26 13:59:02 +02:00
Nikita Galaiko
3cdce00170 refactor: simplify checkout options in merge and apply branch functions
The merge_virtual_branch_upstream, apply_branch, and update_base_branch functions had repetitive code for checking out conflicts. This commit refactors the code to use a new CheckoutIndexBuilder struct, which simplifies the checkout options and makes the code more readable.
2023-09-26 10:52:46 +02:00
Nikita Galaiko
9f721e57d9 refactor: simplify code for checking out tree and add builder pattern for checkout options
The code for checking out a tree has been simplified by removing unnecessary code and using the builder pattern for checkout options. This makes the code more readable and maintainable.
2023-09-26 10:43:13 +02:00
Nikita Galaiko
18371227e8 refactor: simplify code for adding index entry and building working directory tree 2023-09-26 10:30:16 +02:00
Nikita Galaiko
065c00b011 reduce amount of opened file for locks 2023-09-25 10:36:51 +02:00
Scott Chacon
43beb0f5d5
fix: update merge_virtual_branch_upstream function to accept optional keys_controller parameter 2023-09-21 10:05:23 +02:00
Scott Chacon
3130d5fd1a merged upstream 2023-09-21 09:32:34 +02:00
Scott Chacon
c81b4e363f
merge test 2023-09-21 09:32:27 +02:00
Nikita Galaiko
34274bb3de explicitly define git url 2023-09-20 15:56:48 +02:00
Scott Chacon
aff8f261e2
add tests, remove other branches before merging, checkout conflict state 2023-09-20 15:25:12 +02:00
Nikita Galaiko
5c98330cc0 remove old commit page 2023-09-20 12:33:03 +02:00
Nikita Galaiko
c97b638f2f small fixes 2023-09-20 12:15:05 +02:00
Nikita Galaiko
1b520ca44d test 2023-09-20 11:56:16 +02:00
Nikita Galaiko
5f4b7acfc1 refactor: git commit signing 2023-09-20 11:53:59 +02:00
Scott Chacon
b2833e2549 feat: add merge_virtual_branch_upstream function to merge upstream changes into branch
The merge_virtual_branch_upstream function is added to merge the changes from the upstream branch into the current branch. This function checks if the project is in a conflicted state and if not, it proceeds with the merge. It finds the merge base between the upstream commit and the current branch's head commit, and then tries to merge the working directory tree with the remote tree. If the merge is successful, it commits the merge tree and updates the branch data.
2023-09-20 10:23:32 +02:00
Scott Chacon
d833643abf fix up stuff, remove debug, add test assert 2023-09-19 15:55:32 +02:00
Scott Chacon
c3adce8238 Merge remote-tracking branch 'origin/master' into sc-signing-2 2023-09-19 15:45:05 +02:00
Scott Chacon
e60c5e58d2 signing try number 2 2023-09-19 15:13:06 +02:00
Nikita Galaiko
60b4c63078 feat: refactor virtual branch module structure and add materialized view structs for presentation purposes
The virtual branch module structure has been refactored to improve code organization and readability. The module now consists of separate files for virtual branch, remote, and files related functionality.

Additionally, materialized view structs have been added for presentation purposes. These structs include `VirtualBranch`, `VirtualBranchCommit`, `VirtualBranchFile`, and `VirtualBranchHunk`. These structs provide a materialized view of the virtual branch data and are used for presentation purposes through the IPC.

This refactoring improves code maintainability and provides a clearer separation of concerns between the virtual branch module and the presentation layer.
2023-09-19 13:02:51 +02:00
Nikita Galaiko
160eae4e22 fix function call 2023-09-18 15:11:20 +02:00
Nikita Galaiko
7ca7dfd3e2 cargo fmt 2023-09-18 15:05:57 +02:00
Nikita Galaiko
e98f8bbf7b merged upstream 2023-09-18 15:04:15 +02:00
Nikita Galaiko
0caf0366e3 commit files fetching async 2023-09-18 15:04:09 +02:00
Nikita Galaiko
49d5295911 no error is branch is already applied 2023-09-18 13:59:50 +02:00
Nikita Galaiko
f5a525d840 make isMergeable asyncronous 2023-09-18 10:39:48 +02:00
Nikita Galaiko
4e568420c8 fetch isMergeable asyncronously 2023-09-18 10:00:56 +02:00
Nikita Galaiko
2cfe510fc4 add can apply methods 2023-09-18 09:15:49 +02:00
Nikita Galaiko
602fca0e87 cargo fmt 2023-09-15 13:28:10 +02:00
Nikita Galaiko
f5a24cf5e5 get rid of git_commit_diff call 2023-09-15 13:24:07 +02:00
Nikita Galaiko
edbbe1f0a8 get rid of virtual / remote confusion 2023-09-15 12:46:25 +02:00
Nikita Galaiko
ae40f6abda do not send conflicts back 2023-09-15 10:11:45 +02:00
Nikita Galaiko
ee82ea03ce rm some unused code 2023-09-15 09:30:51 +02:00
Nikita Galaiko
0526d11b56 fix tests 2023-09-14 15:31:50 +02:00
Nikita Galaiko
a832a877ea rm instrumentation 2023-09-14 15:27:03 +02:00
Nikita Galaiko
df97887f52 start removing fields 2023-09-14 15:24:52 +02:00
Nikita Galaiko
b05fe81000 add db connections pool 2023-09-14 12:23:25 +02:00
Nikita Galaiko
682c2e1b82 sort tauri cargo 2023-09-14 09:07:58 +02:00
Nikita Galaiko
3c0d4acabe remove terminal 2023-09-14 08:16:26 +02:00
Nikita Galaiko
33cf7e7e63 remove files database 2023-09-13 13:53:59 +02:00
Nikita Galaiko
4da0553405 more tests 2023-09-12 13:05:01 +02:00
Nikita Galaiko
3a2e2ca34c consequential partial commits fix 2023-09-12 12:57:29 +02:00
Nikita Galaiko
e530e3c25f add failing test 2023-09-12 11:00:27 +02:00
Nikita Galaiko
489f64fffc apply log level filter to file 2023-09-08 09:25:29 +02:00
Nikita Galaiko
04524fbc2c build debs 2023-09-07 17:29:27 +02:00
Nikita Galaiko
b79377c990 cargo fmt 2023-09-07 17:18:56 +02:00
Nikita Galaiko
6bcea9a891 allow specifying ownership for partial commit 2023-09-07 17:16:07 +02:00
Nikita Galaiko
ed2d126d8c bumps 2023-09-07 13:48:04 +02:00
Nikita Galaiko
99a0c52345 when updating branch ownership, use raw version 2023-09-07 09:52:52 +02:00
Nikita Galaiko
b98876da98 send posthog event on branch change 2023-09-06 15:05:56 +02:00
Nikita Galaiko
746e8ccabc
new structure 2023-09-06 11:47:35 +02:00