Commit Graph

400 Commits

Author SHA1 Message Date
Mattias Granlund
5bb8c25aca Fix bug in updating base branch
- drop "double lock across branches" test because it can't happen
- save correct tree when updating branch states
- use correct integration commit when updating base branch
2024-05-02 17:39:52 +02:00
Josh Junon
6747da6e50
simplify default target retrieval logic 2024-05-02 13:28:21 +02:00
Josh Junon
664aadcd1c
eliminate redundancy in unix timestamp retrieval 2024-05-02 12:43:35 +02:00
dependabot[bot]
a1a3abc868
Bump the rust-updates group with 10 updates
Bumps the rust-updates group with 10 updates:

| Package | From | To |
| --- | --- | --- |
| [serde](https://github.com/serde-rs/serde) | `1.0.197` | `1.0.199` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.58` | `1.0.59` |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.81` | `1.0.82` |
| [async-trait](https://github.com/dtolnay/async-trait) | `0.1.79` | `0.1.80` |
| [chrono](https://github.com/chronotope/chrono) | `0.4.37` | `0.4.38` |
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.12.2` | `0.12.4` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.115` | `1.0.116` |
| [ssh-key](https://github.com/RustCrypto/SSH) | `0.6.5` | `0.6.6` |
| [tauri](https://github.com/tauri-apps/tauri) | `1.6.1` | `1.6.2` |
| [sysinfo](https://github.com/GuillaumeGomez/sysinfo) | `0.30.8` | `0.30.11` |


Updates `serde` from 1.0.197 to 1.0.199
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.197...v1.0.199)

Updates `thiserror` from 1.0.58 to 1.0.59
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.58...1.0.59)

Updates `anyhow` from 1.0.81 to 1.0.82
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.81...1.0.82)

Updates `async-trait` from 0.1.79 to 0.1.80
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.79...0.1.80)

Updates `chrono` from 0.4.37 to 0.4.38
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.37...v0.4.38)

Updates `reqwest` from 0.12.2 to 0.12.4
- [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.12.2...v0.12.4)

Updates `serde_json` from 1.0.115 to 1.0.116
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.115...v1.0.116)

Updates `ssh-key` from 0.6.5 to 0.6.6
- [Commits](https://github.com/RustCrypto/SSH/compare/ssh-key/v0.6.5...ssh-key/v0.6.6)

Updates `tauri` from 1.6.1 to 1.6.2
- [Release notes](https://github.com/tauri-apps/tauri/releases)
- [Commits](https://github.com/tauri-apps/tauri/compare/tauri-v1.6.1...tauri-v1.6.2)

Updates `sysinfo` from 0.30.8 to 0.30.11
- [Changelog](https://github.com/GuillaumeGomez/sysinfo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/GuillaumeGomez/sysinfo/compare/v0.30.8...v0.30.11)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: ssh-key
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: tauri
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
- dependency-name: sysinfo
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: rust-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 15:11:55 +00:00
GitButler
28ca280c0d fix: removing an update all projects operation on read
this is no longer needed and it is causing an issue on windows
2024-04-30 13:42:34 -07:00
Josh Junon
d71e4d3617
escape env vars and use raw args on windows in fork/exec git 2024-04-30 14:56:21 +02:00
Josh Junon
d0f1082c7f
Merge pull request #3637 from gitbutlerapp/fix-git-forkexec-ssh-command
also check GIT_SSH when looking for base ssh command
2024-04-30 12:21:54 +02:00
Josh Junon
8d942d6557
pull git ssh commands from surrounding environment as fallback 2024-04-30 12:09:05 +02:00
Josh Junon
de2622c2b6
also check GIT_SSH when looking for base ssh command (ref #3624) 2024-04-30 11:59:15 +02:00
Josh Junon
b350a85e5c
add google images CDN to img-src CSP (fixes #3516) 2024-04-30 11:48:00 +02:00
Kiril Videlov
0d8b97b36c
fix: undo snapshots will disregard files larger than 32MB
Ensuring that a snapshot "undo" does not remove those files
2024-04-29 20:28:27 +02:00
Kiril Videlov
27480c503e
Merge pull request #3629 from gitbutlerapp/remove-rust-posthog-integration
remove posthog from the rust code
2024-04-29 16:28:11 +02:00
Scott Chacon
786a834559
Merge pull request #3626 from gitbutlerapp/sc-history-manipulation
operation tonkotsu 2
2024-04-29 16:17:57 +02:00
Kiril Videlov
00706b402b
remove posthog from the rust code
similar to https://github.com/gitbutlerapp/gitbutler/pull/3628
2024-04-29 16:12:14 +02:00
Kiril Videlov
6439f3333a
remove sentry rust dependencies 2024-04-29 15:54:13 +02:00
Kiril Videlov
83b40eabb6
remove sentry from rust code
Since the actually valuable bug reports are submitted by developers as github issues or on our Discord, sentry error reporting is not necessary
2024-04-29 15:46:29 +02:00
Scott Chacon
c5e7fe865c fix clippy issues
fix a few more clippy issues
2024-04-29 15:42:58 +02:00
Scott Chacon
2b1d808314 add several history manipulation backend functions
this adds backend functions in Rust to do the following:
* move file hunks between commits (basic)
* undo any commit in a stack
* insert a blank commit
* move a commit within the stack
* update a commit message in place
2024-04-29 15:03:01 +02:00
Kiril Videlov
ae7bb0d2ee
feat: Enhance OperationType handling in SnapshotDetails 2024-04-29 12:08:56 +02:00
Kiril Videlov
7e11171211
fix: snapshot uses uses gitbutler as comitter 2024-04-28 20:38:34 +02:00
Kiril Videlov
27ce10cdcf
add test asserions for restoring virtual_branches.toml 2024-04-28 20:23:02 +02:00
Kiril Videlov
3be8dd444b
fixes a snapshot restor bug where untracked files arent removed 2024-04-28 20:08:47 +02:00
Kiril Videlov
34d12fb1e6
add snapshotting tests 2024-04-28 20:05:46 +02:00
Kiril Videlov
b0e0fc790c
feat: Add tests for updating the oplog head and target head 2024-04-28 12:08:32 +02:00
Kiril Videlov
6ff0d551eb
fix test 2024-04-27 23:43:25 +02:00
Kiril Videlov
d65f723ec0
test: Add tests for set_reference_to_oplog function 2024-04-27 23:27:39 +02:00
Kiril Videlov
8b0dd6cc21 skip tempfile under windows 2024-04-27 17:15:08 +02:00
Sebastian Thiel
4f58883bd4
try to fix regression on Windows due to tempfiles semantics (#3601)
Until `perist()` is truly atomic also on Windows, and modelled
[after Git](https://github.com/git/git/blob/master/compat/mingw.c#L2159-L2209),
sans the retries, it seems to work to just perform ordinary writes.

Before going there though, we try to call `sync_all()` on Windows to truly
finish the operation. On Unix, a rename is already supposed to be atomic.
2024-04-27 16:11:28 +02:00
Sebastian Thiel
91d892882e
Deduplicate all 'write' code
GB writes files atomically and in the end it boils down to allocating bytes
and writing them all at once.

Now this capability lives in the `fs` module.
2024-04-27 16:11:27 +02:00
Kiril Videlov
9d534b09ca
snapshots - read full commit meesage 2024-04-26 23:33:39 +02:00
Kiril Videlov
5420fc3e3c
use new snapshot types 2024-04-26 23:20:31 +02:00
Kiril Videlov
371a944e71
add types for the different kinds of snapshots
Serializing and deserializing snapshot trailers
2024-04-26 22:35:09 +02:00
Josh Junon
adcba68220
move multi-file modules to mod.rs and single-file modules to <name>.rs 2024-04-26 11:56:35 +02:00
Sebastian Thiel
a08e2be07e
OwnershipClaims now allocates less
This is done by allowing to take (rust) ownership where internally
the item is consumed.
2024-04-26 07:08:43 +02:00
Sebastian Thiel
6c90381bcf
Use iterators for transformation, and avoid copies by default. 2024-04-26 07:08:41 +02:00
Sebastian Thiel
9dddd77899
Make it more obvious to devs how to make core tests pass.
Now a binary is required which might not always be present, nor is
it created as pre-requisite of the test.

Until that is the case, say how this can be fixed.
2024-04-26 07:07:44 +02:00
Mattias Granlund
311a582a8c Minimise range in double lock test
todo: figure out why we can't use only three lines in this test
2024-04-26 00:06:01 +02:00
Mattias Granlund
c5c2df1b93 Surface warning if hunk locked to multiple branches
- now returning `HunkLock` to front end
- detect if locked to more than one branch and warn user
2024-04-26 00:06:01 +02:00
Sebastian Thiel
ff44a80e74
Merge pull request #3607 from Byron/win-fixes
Revert 74eb7bd3 as debounce-timing has no effect (#3601)
2024-04-25 22:07:37 +02:00
Kiril Videlov
fd1ac5d65b
improved snapshot labels 2024-04-25 21:44:30 +02:00
Kiril Videlov
33859c89ef
adds some documentation 2024-04-25 21:09:02 +02:00
Kiril Videlov
bedc918b84
simplify reflog reference setting 2024-04-25 20:51:24 +02:00
Kiril Videlov
9a499575c4 fixes a bug with the reflog editing 2024-04-25 19:23:13 +02:00
Kiril Videlov
4c92caafd4 create simple snapshots on branch operations 2024-04-25 19:23:13 +02:00
Kiril Videlov
9a07f50244 fix: correctly handle the case of the feature flag being absent 2024-04-25 19:23:13 +02:00
Kiril Videlov
b3c05b7948 fix signatures 2024-04-25 19:23:13 +02:00
Kiril Videlov
432aeeaf2a feature flag for snapshot creation 2024-04-25 19:23:13 +02:00
Kiril Videlov
753953a7d5 remove tauri endpoint for creating snapshots 2024-04-25 19:23:13 +02:00
Kiril Videlov
5e395a3700 snapshot reflog doesnt need to be exposed 2024-04-25 19:23:13 +02:00
Kiril Videlov
3d04c7fc5b set target ref on snapshot 2024-04-25 19:23:13 +02:00
Kiril Videlov
0911212a9c handle commit not found 2024-04-25 19:23:13 +02:00
Kiril Videlov
ca4f79f7ff reflog entry for the snapshots 2024-04-25 19:23:13 +02:00
Kiril Videlov
a2682e2535 implement undo stack snapshotting 2024-04-25 19:23:13 +02:00
Sebastian Thiel
066d520f1a less cumbersome error handling for Git errors 2024-04-25 16:42:11 +02:00
Mattias Granlund
e0c2d82127 Reset files into the same branch they were committted to
- regressed when switching to blame for hunk locking
2024-04-25 16:42:11 +02:00
Sebastian Thiel
116f5d02bc
Revert 74eb7bd3 as debounce-timing has no effect (#3601)
This probably means the raciness is not due concurrency introduced by filesystem events,
which leads me to think that having great 'disk-IO-hygiene` should improve things.'
2024-04-25 16:33:55 +02:00
Mattias Granlund
44c64565a2 Add test to ensure hunks can lock across branches
- makes no assertions about how the hunk is displayed
2024-04-25 16:06:03 +02:00
Mattias Granlund
d79b126c59 Remove repetition in create_commit.rs test code 2024-04-25 16:06:03 +02:00
Sebastian Thiel
29525ffd03
address review comments
- rename feature to `windows`
- remove unused config key from `Cargo.toml`, unfortunately `cfg` isn't available for everything
- make sure feature is toggled on on CI when checking and when publishing
2024-04-25 11:29:24 +02:00
Sebastian Thiel
3058ffbc9b
avoid showing colors in Windows logs (#3601)
People can't copy it without the terminal-escape code, making it harder to read.
2024-04-25 08:19:59 +02:00
Sebastian Thiel
74eb7bd397
on Windows, update far less often on filesystem changes. (#3601)
By increasing the window size for collecting filesystem events,
knowing that each event is processed in parallel, we might be lucky
and that already reduces the likelyhood of clashes.

It's an experiment though.

On Unix, run with:

`LOG_LEVEL=debug pnpm tauri dev --features adapt-to-windows`
2024-04-25 08:17:11 +02:00
Kiril Videlov
bb48dff72a project deleteion cleans up virtual_branches.toml 2024-04-24 17:50:39 +02:00
Josh Junon
40f7234708
Merge pull request #3596 from Byron/fix-mode-windows
avoid to make files executable on Windows (#3329).
2024-04-24 16:23:35 +02:00
Sebastian Thiel
a46de60d10 make tests work
This is accomplished by settig the test-feature when running `core` tests.
There is also a safeguard to help assuring this doesn't land in production.
2024-04-24 16:13:05 +02:00
Kiril Videlov
7f4aec50cf make git system executable the default auth flow 2024-04-24 16:13:05 +02:00
Sebastian Thiel
34770a4b77
avoid forcefully making files executable on Windows (#3329).
Instead, respect the existing bit if set in Git, but do not try
to derive it from the filesystem which is something Git doesn't
seem to be doing on Windows either.

This also makes me think that `gitoxide` should make it easy
to build a tree from a file and deal with this.
2024-04-24 15:14:22 +02:00
Sebastian Thiel
6033a62a94 use gix::tempfile in place of the tempfile.
This allows to unify handling of filewrites in more places.
2024-04-24 13:14:20 +02:00
Sebastian Thiel
6665bc9289
Use a temp-file to write new content atomically in storage layer (#2807)
This will prevent half-written content on disk in case the write is interrupted.

Lock files are *not* used as the assumption is that a lock is held centrally.
2024-04-24 10:38:48 +02:00
Mattias Granlund
90cf617a4f Add test for locking hunk to two different commits 2024-04-24 08:15:01 +01:00
Mattias Granlund
5134460875 Tighten locking tests
- with blame based lock a change can touch a committed line, but not overlap
2024-04-24 08:15:01 +01:00
Mattias Granlund
c202d83b6b Allow hunk locking to multiple commits
- adds `locked_to` field to `GitHunk` to avoid looking it up again
- sends array to ui instead of single commit id
2024-04-24 08:15:01 +01:00
Mattias Granlund
a664c85a9a Fix typo 2024-04-24 08:15:01 +01:00
Mattias Granlund
8140afb88b Use adjacent hunks in commit/lock detection test
We still need to fix the off-by-one bug affecting hunk end lines. When we add start_line + line_count we end up with an extra line. For example, with start_line 1, and line_count 1, the range is 1:1, not 1:2.
2024-04-24 08:15:01 +01:00
Mattias Granlund
0a1fbdce9a Add integration_commit_id as optional param to update_gitbutler_integration 2024-04-24 08:15:01 +01:00
Mattias Granlund
811f0ee35b Blame across workspace instead of by branch
- refactors `update_gitbutler_integration`
- creates new `get_workspace_head` function
- ignore locking when resolving merge conflicts
2024-04-24 08:15:01 +01:00
Mattias Granlund
2f7b396ab8 Remove extra indirector for blame function 2024-04-24 08:15:01 +01:00
Mattias Granlund
8dd4a92622 Use empty vector instead of None 2024-04-24 08:15:01 +01:00
Mattias Granlund
055c7e7119 Use blame for hunk locking
- replaces commit walking with a git blame
- limited to specific hunk lines
- earliest_commit set to default target
- lock if any blame other than boundary commit
- intersection uses context lines
2024-04-24 08:15:01 +01:00
Sebastian Thiel
aa3d3cb7da fix rustfmt formatting issues due to line-length (#3039)
The trick is to temporarily set `max_width` in `rustfmt.toml` to 120,
then set it back to the default of 100 (or remove the file).
2024-04-23 12:53:56 +02:00
Sebastian Thiel
5ea4bb3c58 don't fail if a ref can't be peeled (#3129)
Sometimes, symbolic refs are used as tracking branches, like
`refs/remotes/origin/HEAD`, and after some changes are dangling,
pointing to a ref which doesn't exist anymore (maybe it was renamed
from `master` to `main`).

Now, this isn't fatal anymore, but will be logged instead.
2024-04-23 12:53:56 +02:00
Sebastian Thiel
118bea95d1 for HTTP-based errors, attach Code to allow UI to show improved message (#2886)
Now thanks to a specific `Code`, the UI could display special text to help users
solve the issue related to workflow files.
2024-04-23 11:32:53 +02:00
Sebastian Thiel
bb7824e7c0 assure that root-causes are always provided instead of "Something went wrong". (#2886)
In the previous commit it was stated that the 'unfolding' of errors might
have been intentional to surface root causes of error messages.

However, this might have been wrong, and this commit brings back root-causes explicitly,
while erroring on the side of caution. That is, "Something went wrong" probably won't
be shown anymore, instead, possibly too much will be displayed and we'd rather tune
that down once it becomes clear which messages are needed, or should be improved.

Overall, I think it's best to show more, and then tune errors with custom context
where needed.
2024-04-23 11:32:53 +02:00
Sebastian Thiel
6f764f5fd6 assure important errors are passed as context (#2886)
Previously, errors would be 'unfolded' so there was no error chain,
but the lowest error would become the top-most one that way.

I thought this was accidental, but it turns out that it wasn't.
To fix this generally, make sure that we always use the message
of the lowest-possible error if no context is provided.
2024-04-23 11:32:53 +02:00
Sebastian Thiel
9bbba057f4 fix some typos that could be user-facing 2024-04-23 11:32:53 +02:00
Josh Junon
31ce4574bd
Merge pull request #3575 from gitbutlerapp/Fix-Gitea
Allow SSH remotes to use any port
2024-04-22 11:47:04 +02:00
Sebastian Thiel
b60d49f752 a clear error message when bare repositories are encountered and rejected (#2704)
This also rewrites some other checks in preference of opening the git directory
in isolation. Doing so is very fast, and the only way to know for certain if a
repository is bare.

In future, once the repository is more separated from the worktree (in terms of mindset)
it should be possible to handle bare repos with worktrees as well.
2024-04-22 11:01:07 +02:00
Sebastian Thiel
a5bda226ef provide better errors when adding a project (#2608)
The issue initially was that the wrapping of anyhow around a `thiserror`
type, which is when manually added context gets lost as there is no way
to downcast such an `anyhow` error back to a concrete type without
wanting to know it.

The solution was to remove the intermediate `thiserror` type which didn't
serve an actual purpose.
2024-04-22 10:59:03 +02:00
Caleb Owens
76556eb6c8 Remove useless reference 2024-04-21 22:45:00 +01:00
Caleb Owens
5c74cc79b5 Allow SSH remotes to use any port 2024-04-21 19:32:02 +01:00
Sebastian Thiel
f4a8aa5592
flyby refactor to do a little less copying 2024-04-21 11:35:26 +02:00
Sebastian Thiel
568d35fa90
refactor
- assure that `repository` can't be misused in `hunks_by_filepath()`.
- Use more obvious enumeration to describe and match on lines
- make clear that diff_lines can be a hash
- avoid multiple hashmasps if one would do
- `Hunk::hash_diff` now uses lines with terminator to be close to being a true content hash. This was probably intended by the code originally.
2024-04-21 11:35:26 +02:00
Sebastian Thiel
04bcf3b8b2
adjust Hunk::hash_diff() to produce unique hashes based on input.
The input is variable and maybe empty, maybe a diff header followed
by diff-lines, and it could be an SHA1 of a binary file, which now is
hashed like any other content.
2024-04-21 11:35:26 +02:00
Sebastian Thiel
be4cd36986
clarify some TODOs to avoid keeping them for too long
Note that the comment above 'deltas' merely removed, as it wasn't actionable
without changing the frontend, which can probably already deal with
multiple of these.

Now that types are better understood though, it was straightforward to
change the type of `file_path` to not be a string, which now is even
clearer of a necessity thanks to the `tauri`-independent `watcher` crate.

Also, remove a comment related to the lack of worktree support.
It now fails gracefully, and that will come up again if support should be added.
2024-04-21 11:35:26 +02:00
Sebastian Thiel
fb83dafd8b
Make using Hunk::hash with something that's not a hash a hard error.
Fix all occasions where this seems to be used like this.
2024-04-21 11:35:25 +02:00
Sebastian Thiel
eb0db39387
Strongly type the hunk-hash to avoid String, but remain compatible.
This change also avoids allocating for the hash, while keeping
everything else the same.
2024-04-21 11:35:25 +02:00
Sebastian Thiel
3aecf4d57e
Make sure users can more easily delete vbranch information on failure
If for whichever reason the parsing of parts of the vbranch.toml file
fails, this would be a permanent error until the file is fixed or removed.

Now it's also displayed along with the error to make clearing the file
more convenient.
2024-04-21 11:35:25 +02:00
Sebastian Thiel
ebf693e667
prevent unnecessary copies in Hunk::with_* methods 2024-04-21 11:35:25 +02:00
Sebastian Thiel
9e11127356
don't assume UTF8 encoding in commit message
Instead, fail gracefully by displaying fill-characters.
Ideally, we would be able to use the commit-encoding header field as well,
but one step at a time.
2024-04-21 11:35:25 +02:00
Sebastian Thiel
188fc2d5f1
Make sure UI types use strings instead of BString
Otherwise the frontend will see a byte-representation, and fails to operate
on the data.
2024-04-21 11:35:25 +02:00
Sebastian Thiel
27714d8e0d
Adjust GitHunk to not require UTF8 for diffs
This will make the diffing engine more correct overall, as only for
display there will be a potentially lossy conversion.

This will also prevent it to be considered binary even though it is not.
2024-04-21 11:35:25 +02:00
Sebastian Thiel
fe950ec00a
refactor
- adjust comment in watcher to actually show how it works.
2024-04-21 11:35:25 +02:00
Kiril Videlov
0fea544cd7
rm gb_repository from controller 2024-04-21 09:26:34 +02:00
Kiril Videlov
ee62577012
remove gb_repository from remote 2024-04-21 09:16:14 +02:00
Kiril Videlov
9ca847b2a3
remove gb_repository from base 2024-04-21 09:10:37 +02:00
Kiril Videlov
b8fcddb945
remove unused feature flag function 2024-04-20 10:32:49 +02:00
Sebastian Thiel
56d0943962
refactor
- don't convert paths to strings and use a set for membership checks
2024-04-20 09:10:11 +02:00
Sebastian Thiel
6e0706b6ef
Use the new worktree specific listing function (#3552)
It respects git excludes during traversal, which should also speed it
up when facing ignored direectories with many files.
2024-04-20 09:09:02 +02:00
Sebastian Thiel
cf81401b5a
add a function for worktree file listings specifically
This introduces `gix` to the codebase and uses it selectively
to traverse a worktree while respecting git excludes.
2024-04-20 09:07:17 +02:00
Kiril Videlov
69b048321e
Merge pull request #3564 from gitbutlerapp/update-virtual-branch-handles
update-virtual-branch-handles
2024-04-20 00:59:55 +02:00
Kiril Videlov
543e85dcfb
fix clippy 2024-04-20 00:47:42 +02:00
Kiril Videlov
118af702da
add some docs 2024-04-20 00:47:07 +02:00
Kiril Videlov
f95790f2fa
remove unused function on VirtualBranchesHandle 2024-04-20 00:46:58 +02:00
Kiril Videlov
72398719bc
rm test command 2024-04-20 00:38:18 +02:00
Kiril Videlov
6334336e7b
remove branch reader / writer 2024-04-19 23:48:11 +02:00
Kiril Videlov
86fe1e2735
remove target reader / writer 2024-04-19 23:29:13 +02:00
Kiril Videlov
442eb88eaa rm target writer from unrelated tests 2024-04-19 23:13:27 +02:00
Kiril Videlov
e485566a2a
remove unused import 2024-04-19 22:57:05 +02:00
Kiril Videlov
0dccc5634a
rm gb_repository from create_virtual_branch_from_branch 2024-04-19 22:56:07 +02:00
Kiril Videlov
8fba308e43
rm gb_repository from move_commit 2024-04-19 22:55:35 +02:00
Kiril Videlov
a35ced3826
rm gb_repository from update_commit_message 2024-04-19 22:54:54 +02:00
Kiril Videlov
7aa574d5a0
rm gb_repository from squash 2024-04-19 22:54:13 +02:00
Kiril Videlov
953221b499
rm gb_repository from cherry_pick 2024-04-19 22:53:38 +02:00
Kiril Videlov
9b049271b7
rm gb_repository from amend 2024-04-19 22:52:58 +02:00
Kiril Videlov
01100a5407
rm gb_repository from commit 2024-04-19 22:52:17 +02:00
Kiril Videlov
a7219d38f2
rm gb_repository from reset_branch 2024-04-19 22:51:07 +02:00
Kiril Videlov
b6c6159b1b
rm gb_repository from delete_branch 2024-04-19 22:50:31 +02:00
Kiril Videlov
f1cee4bf11
rm gb_repository from merge_virtual_branch_upstream 2024-04-19 22:49:53 +02:00
Kiril Videlov
eb1c0ca721
rm gb_repository from list_virtual_branches 2024-04-19 22:48:43 +02:00
Kiril Videlov
1240177dcf
rm gb_repository from unapply_branch 2024-04-19 22:47:13 +02:00
Kiril Videlov
749cde0112
rm gb_repository from unapply_ownership 2024-04-19 22:45:33 +02:00
Kiril Videlov
45c1342a53
rm gb_repository from apply_branch 2024-04-19 22:44:42 +02:00
Kiril Videlov
21fdfb4272
rm gb_repository from go_back_to_integration 2024-04-19 22:43:26 +02:00
Kiril Videlov
676fb0e8fa
rm gb_repository from update_gitbutler_integration 2024-04-19 22:39:46 +02:00
Kiril Videlov
b77818c31e
rm gb_repository from update_branch 2024-04-19 22:23:24 +02:00
Kiril Videlov
b1c6af328e
rm gb_repository from get_status_by_branch 2024-04-19 22:18:35 +02:00
Kiril Videlov
954f960f1b
rm gb_repository from get_applied_status 2024-04-19 22:15:39 +02:00
Kiril Videlov
81f3cf47e3
rm gb_repository from push 2024-04-19 22:14:00 +02:00
Kiril Videlov
6dc51f4d12
rm gb_repository from is_remote_branch_mergeable 2024-04-19 22:12:37 +02:00
Kiril Videlov
2e1c46c0a6
rm gb_repository from is_virtual_branch_mergeable 2024-04-19 22:11:30 +02:00
Kiril Videlov
67a8d03254
rm gb_repository from verify branch 2024-04-19 22:09:28 +02:00
Kiril Videlov
6853f0859e
rm gb_repository param from create_virtual_branch 2024-04-19 22:05:33 +02:00
Kiril Videlov
7fb642df07
fix test 2024-04-19 21:54:33 +02:00
Kiril Videlov
e82483fb88
get_branch_target returns default on not found
Matching the previous semantics
2024-04-19 21:54:24 +02:00
Kiril Videlov
d57cba4d31
migrate base to VirtualBranchState 2024-04-19 21:41:22 +02:00
Kiril Videlov
2c5465639c
migrate repository to VirtualBranchState 2024-04-19 21:40:33 +02:00
Kiril Videlov
c152060cbf
migrate virtual_branches to VirtualBranchState 2024-04-19 21:39:33 +02:00
Kiril Videlov
098e80d484
migrate integration to VirtualBranchesHandle 2024-04-19 20:19:19 +02:00
Kiril Videlov
44faf660c3
separate list_branches and list_branch_ids 2024-04-19 19:53:32 +02:00
Kiril Videlov
4f43d075ee
migrate controller to VirtualBranchesHandle 2024-04-19 19:13:55 +02:00
Kiril Videlov
6383cd0d59
match VirtualBranchesHandle interface with readers 2024-04-19 19:12:44 +02:00
Josh Junon
d5b34c46f5
mark package info as potentially unused 2024-04-19 16:01:54 +02:00
Josh Junon
7f35537798
only construct about metadata on macos 2024-04-19 15:49:23 +02:00
Josh Junon
ed088f4431
enable devtools on release builds, too 2024-04-19 15:17:44 +02:00
Josh Junon
340eaeaf8c
re-construct the full menu instead of using OS default 2024-04-19 15:15:56 +02:00
Josh Junon
d091a357be
fix cargo warnings 2024-04-18 15:43:58 +02:00
Josh Junon
450b1aeee9
add rt/macros to tokio in core for tests 2024-04-18 15:26:10 +02:00
Sebastian Thiel
125b329ab8
fix build on Windows 2024-04-18 13:45:53 +02:00
Kiril Videlov
0c11a0efcb use toml vbranch state by default 2024-04-18 13:12:39 +02:00
Kiril Videlov
f7f7ba992b fix: valid ownership claims in test 2024-04-18 13:12:39 +02:00
Kiril Videlov
fdee7abe0b remove unused show_file_at_tree 2024-04-18 12:12:28 +02:00
Kiril Videlov
ce14ea3b0b
Merge pull request #3541 from Byron/watcher-crate
split `tauri/watcher` into crate
2024-04-18 11:40:31 +02:00
Sebastian Thiel
5d9e593887
refactor
- add note related to negative pathspecs and performance implication of the current impl.
- deduplicate code for readability
2024-04-18 11:06:38 +02:00
Sebastian Thiel
c30ac3ba62
optimize tokio features
Previously, the attempt was made to enable only those `tokio` features
that are actually used. However, due to default-features still being
enabled and `tauri` using the `full` feature, for most intents and purposes
that wasn't effective.

Now default features are disabled, and `full` isn't used anymore, forcing
all crates to mention the exact features they need.

Note that `tracing` is missing here, as it wasn't effective previously
without the `--cfg tokio_unstable` option also being specified as rustflag.
2024-04-18 09:48:23 +02:00
Sebastian Thiel
adfbc7c5cc
Remove now unused dependencies from tauri.
These have moved to `watcher` and `analytics` respectively.
2024-04-18 09:25:33 +02:00
Sebastian Thiel
5785085a77
reintegrate watcher crate into tauri crate 2024-04-17 22:20:32 +02:00
Sebastian Thiel
81dd1fc13e
The watcher-crate compiles and tests run 2024-04-17 21:46:06 +02:00
Sebastian Thiel
143fc05547
add analytics crate based on tauri/analytics 2024-04-17 20:56:04 +02:00
Sebastian Thiel
5223c197d2
add watcher crate with code copied from gitbutler-tauri/src/watcher.
It's not functional yet, but exactly at the spot where it needs fixing
across the boundary that is:

- a stand-in for application events
- analytics
2024-04-17 19:15:17 +02:00
Sebastian Thiel
ccbe8fd738
improved error message when worktrees are encountered upon project-add (#3062)
Note that this is a first step towards making worktree support possible.
2024-04-17 18:37:20 +02:00
Sebastian Thiel
a482473453
add a test to core that should work when worktrees are properly supported (#3062)
This reproduces #3062.
2024-04-17 17:32:34 +02:00
Kiril Videlov
044f427810
rm functions for adding context lines to hunks 2024-04-17 07:23:34 +02:00
Kiril Videlov
45361df57c
rm use_diff_context feature flag from project 2024-04-17 07:17:36 +02:00
Kiril Videlov
6f0fe2afa9 rm uses_diff_context from list vbranches return 2024-04-17 07:14:43 +02:00
Kiril Videlov
0d296bf9f0
remove functions for adding context lines 2024-04-17 07:02:39 +02:00
Kiril Videlov
993c7109b0
remove unused context_lines option struct 2024-04-17 07:00:19 +02:00
Kiril Videlov
0c331ee86a
remove context_lines parameters 2024-04-17 06:59:13 +02:00
Kiril Videlov
15458cb25f
remove use of diff_context feature flag 2024-04-17 06:52:08 +02:00
Kiril Videlov
17ae8eb119
fix clippy warning 2024-04-16 19:11:42 +02:00
Vid Luther
4ff94d9f4a
happy 2024 2024-04-16 18:17:51 +02:00
Josh Junon
039378cdb7
Merge pull request #3526 from gitbutlerapp/fix-devtools-feature
fix devtools on release builds
2024-04-16 16:56:15 +02:00
Josh Junon
fa06586cdf
fix devtools on release builds 2024-04-16 16:43:22 +02:00
daniilS
e12e741c2e Fix typos in "conflict" in error message, comments, and a variable name 2024-04-16 15:40:14 +01:00
Sebastian Thiel
980d5907f9 Attach more information in case diffy::apply() fails (#3451)
It's made in such a way that strings aren't included, but hashed
to allow a little more insight than would otherwise be possible.
2024-04-16 15:28:14 +01:00
Mattias Granlund
2c7079497b Refactor test for hunk intersection fn
Previous implementation of `joined` would fail this test:
```
st virtual_branches::r#virtual::tests::joined_test ... FAILED
at crates/gitbutler-core/src/virtual_branches/virtual.rs:4139:9:
assertion failed: joined(2, 3, 1, 4)
```
2024-04-16 13:26:28 +01:00
Mattias Granlund
1092d50ddd Fix hunk locking when default target is different from locked_to 2024-04-16 10:55:17 +01:00
Mattias Granlund
203da38e8b Add devtools to view menu 2024-04-16 09:07:11 +01:00
Mattias Granlund
e88d6f990a Fix things that broke tests
- also fixes a few incorrect test assertions
2024-04-16 00:09:04 +02:00
Mattias Granlund
f22b824d41 Rename uncommitted_base -> integration_commit 2024-04-16 00:09:04 +02:00
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