Commit Graph

62 Commits

Author SHA1 Message Date
Mattias Granlund
3005c06729 Include context lines in hunk hash
- git also uses context lines for identification when applying patches
2024-04-16 00:09:04 +02:00
Mattias Granlund
f4750762ed Fix unapply_hunk with uncommitted_branch
- should have been fixed with the other commands
2024-04-16 00:09:04 +02:00
Mattias Granlund
918b78048d Remove no-op function calculate_uncommitted_diffs
- seems like it goes full circle and produces its own input?
- should be investigated still
2024-04-16 00:09:04 +02:00
Mattias Granlund
6b412b1f47 Use uncommitted_base in rest of amend, cherry_pick, etc 2024-04-16 00:09:04 +02:00
Mattias Granlund
c390c8a344 Use ucommitted base in commit as well 2024-04-16 00:09:04 +02:00
Mattias Granlund
b85c7e39ad Fix improper base when calculating virtual branches
- no need to deal with hunks that are already committed
2024-04-16 00:09:04 +02:00
Sebastian Thiel
a3fd06897e
address misc review comments
- turn `static` into `const`
2024-04-15 16:55:03 +02:00
Sebastian Thiel
fb9db89e1b
remove '_pure' functions in favor of creating a full handler in tests.
The `pure` functions were from a time where a `Handler` couldn't be instantiated
in full for tests, but that is not the case anymore, so there isn't any use
for the added complexity.
2024-04-15 16:50:20 +02:00
Sebastian Thiel
62b1c49372
avoid &str in place where ProjectId could be used 2024-04-15 16:23:18 +02:00
Sebastian Thiel
e2ef2dc721
Only watch a single project at a time.
Previously it would watch every registered project, which could incur more work
on all parts of the application than necessary.

Now UI sends an event that indicates which project is active, allowing the
watch to be setup in that very moment. It's worth noting that the previously
watched project is automatically deregistered.
2024-04-15 07:19:15 +02:00
Sebastian Thiel
c173d8074d
parallelize the delta computation 2024-04-15 07:11:16 +02:00
Sebastian Thiel
56642830f0
remove rate-limit as it never kicks in, and also, we'd want the computation for correctness 2024-04-15 07:11:16 +02:00
Sebastian Thiel
2e969d1507
collect filemonitor events into lists to avoid excessive recomputation.
Previously, each file change both in `.git` as well as in the worktree would
cause a complete recomputation. This computation included opening a git
repository at least once (probaby more often), to make an 'is-ignored' check.

The latter is very expensive in `git2` and gets more expensive the more
files there are.

Now the repository is opened when needed, and we re-use it for all applicable
file paths.
2024-04-15 07:11:16 +02:00
Sebastian Thiel
af225bd9e0
make events private and publicly export Event instead.
That way, we get `tauri::Event`, without the somewhat confusing
module  name `events`.
2024-04-15 07:11:16 +02:00
Sebastian Thiel
2eaba14819
dissolve the event queue in favor of method calls
The idea is that we don't parallelize over a channel anymore, but
instead just process filesystem events, one at a time.

This would allow each handler to become a function that gets its
state passed, and makes all the necessary calls verbatim, which
in turn makes it easy to follow what's happening.

If anything becomes to slow due to the serialization of event processing,
selective parallelization can be re-added.
2024-04-15 07:11:09 +02:00
Sebastian Thiel
3902bb9b2d
de-objectify all sub-handlers
Sub-Handlers are objects, and with that comes a lot of complexity.
However, there seems to be on need for it at all, and a first
steps is to turn these into methods to truly understand
what's going on.
2024-04-13 23:09:17 +02:00
Sebastian Thiel
27349a2fa2
Remove Clone in the vincinity of Watchers where possible.
This will help to get away from from the 'everything needs to be shared'
approach to state.
2024-04-13 23:09:17 +02:00
Sebastian Thiel
cdae683757
Turn WatcherInner into Watcher
As `Watcher` really adds nothing.
2024-04-13 23:09:16 +02:00
Sebastian Thiel
1476ff01ee
Avoid managing every piece of the watcher, only manage what's currently needed 2024-04-13 23:09:16 +02:00
Sebastian Thiel
efe03a9b3a
Use the new dispatcher and make sure everything still works 2024-04-13 23:09:16 +02:00
Sebastian Thiel
954d100d95
simplify dispatcher around the idea of a single channel
That way, all objects go away and it will be nothing more than a task
around a channel.
2024-04-13 23:09:16 +02:00
Sebastian Thiel
52c637504e
Don't consume instances that are Send+Sync+Clone
They don't actually need it.
2024-04-13 23:09:16 +02:00
Sebastian Thiel
de6fd55658
remove try_new() in favor of new() in watcher.rs
`try_new()` here is used as constructor, which is what `new` is for
with less boilerplate.
2024-04-13 23:09:16 +02:00
Josh Junon
b818ce485b
Merge pull request #3463 from gitbutlerapp/revert-3448-remove-clippy-alloweds
Revert "Remove unused (?) allow clippy statements"
2024-04-12 18:05:54 +02:00
Josh Junon
db519a4eee
only allow systemexecutable on windows 2024-04-11 12:38:02 +02:00
Josh Junon
a4bc539f56
Merge pull request #3467 from Byron/tests-shared
share test code via separate crate
2024-04-10 04:59:08 -07:00
Sebastian Thiel
4542c73fdb
use workspace dependencies for workspace crates 2024-04-10 13:09:04 +02:00
Josh Junon
67dd25a6d7
removed bail on release windows ci builds 2024-04-09 21:14:56 +02:00
Sebastian Thiel
7d4aede13e
remove clippy lints, or fix them up 2024-04-09 20:45:17 +02:00
Sebastian Thiel
906bfa3cf4
use the new testsupport crate 2024-04-09 20:45:17 +02:00
Sebastian Thiel
3a148a556f
Add a new testsupport crate that contains core/tests/shared.
It's code shared by multiple crates, and should be reusable
by means of a crate.
2024-04-09 20:45:16 +02:00
Josh Junon
8e4ed63a07
Revert "Remove unused (?) allow clippy statements"
This reverts commit 7ee778a0eb.
2024-04-09 14:50:31 +02:00
Sebastian Thiel
91eb4d9b90 fix: assure all top-level application errors are traced. (#3451)
This way, errors are perfectly associated with their respective
top-level tauri function call, which simplifies debugging.

Note that stack-traces are only shown if the `RUST_BACKTRACE`
environment variable is set.
2024-04-09 12:52:20 +02:00
Toby Webb
7ee778a0eb Remove unused (?) allow clippy statements 2024-04-09 12:52:09 +02:00
Josh Junon
7a77d980bf
removed unused import on windows 2024-04-05 12:03:23 +02:00
Josh Junon
b9c07265c2
Merge pull request #3344 from gitbutlerapp/separate-integration-tests
separate integration tests for 'changeset' crate
2024-04-04 14:07:46 +02:00
Sebastian Thiel
4bd5495020
chore(changeset): don't build doc-tests
There are no doctests and it's unlikely there will be anytime soon
as this library isn't for publishing.
2024-04-04 13:53:08 +02:00
Sebastian Thiel
194f8b5235
chore(changeset): assure the crate isn't published.
The crate is only for use by GitButler.
2024-04-04 13:53:07 +02:00
Sebastian Thiel
ee88e1b9b0
chore: separate 'changeset' crate integration tests 2024-04-04 13:53:03 +02:00
Sebastian Thiel
884f8a742d
chore(git): don't build doc-tests, or unit-tests of binaries
There are no doctests and it's unlikely there will be anytime soon
as this library isn't for publishing.

The binaries did try to build unit-tests as well even though these
aren't quite feasible, so they are disabled now to reduce clutter.
2024-04-04 13:46:07 +02:00
Sebastian Thiel
2ee77704c7
chore(git): assure the crate isn't published.
The crate is only for use by `gitbutler`.
2024-04-04 13:46:00 +02:00
Sebastian Thiel
ed2daf5ffb
chore: separate 'git' crate integration tests 2024-04-04 13:45:58 +02:00
Josh Junon
4d78be2d95
fix clippy lints from toolchain update 2024-04-04 12:37:52 +02:00
Josh Junon
59af2953cd
update config to refer to new crate structure 2024-04-04 12:09:12 +02:00
Josh Junon
5a9962bc5a
initial move of crates (no config changes) 2024-04-04 11:49:12 +02:00
Kiril Videlov
cb43625f74
Merge pull request #3394 from gitbutlerapp/dependabot/cargo/rust-updates-edc401d946
build(deps): bump the rust-updates group with 3 updates
2024-04-01 18:15:39 +02:00
dependabot[bot]
69ae2d33b9
build(deps): bump the rust-updates group with 3 updates
Bumps the rust-updates group with 3 updates: [tokio](https://github.com/tokio-rs/tokio), [refinery](https://github.com/rust-db/refinery) and [similar](https://github.com/mitsuhiko/similar).


Updates `tokio` from 1.36.0 to 1.37.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.36.0...tokio-1.37.0)

Updates `refinery` from 0.8.12 to 0.8.13
- [Release notes](https://github.com/rust-db/refinery/releases)
- [Changelog](https://github.com/rust-db/refinery/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-db/refinery/compare/0.8.12...0.8.13)

Updates `similar` from 2.4.0 to 2.5.0
- [Changelog](https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/similar/compare/2.4.0...2.5.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-updates
- dependency-name: refinery
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: similar
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 15:43:50 +00:00
Sebastian Thiel
91a6a3a879
doc: add information on how to use the new error types, and what to consider. 2024-04-01 17:41:31 +02:00
Sebastian Thiel
2aaacdfca7
chore: remove legacy error in favor of new error system 2024-04-01 17:33:14 +02:00
Sebastian Thiel
d0db6a67df
use the new 'app' error type everywhere 2024-04-01 16:19:09 +02:00