Commit Graph

375 Commits

Author SHA1 Message Date
Sebastian Thiel
e82950f177
refactor reflog.rs and slightly adjust snapshot.rs
* reflog
    - use `gix` to parse reflog, both in code as well as in tests (to be sure it's not malformed)
	- avoid double-writes to reflog, instead finish transformation in memory and write final result
    - assure the ref is present, independently of the reflog, catching more 'weird' states.
* minor improvements to `snapshot.rs` to avoid unnecessary clones
2024-05-28 13:25:46 +02:00
Sebastian Thiel
d952db0920
adjust pub to make sense for actual usage (and after trait removal) 2024-05-28 13:25:46 +02:00
Sebastian Thiel
590d713f91
use git2::Oid instead of String; various small refactors 2024-05-28 13:25:46 +02:00
Sebastian Thiel
a5f71be44c
avoid separate exists-checks in favor of detailed error handling
That way we are less racy and do less IO.
2024-05-28 13:25:46 +02:00
Sebastian Thiel
e3156ba75c
remove single-use traits while leaving the structure as is 2024-05-28 13:25:46 +02:00
Sebastian Thiel
346c96869e
small refactors (see body for details)
- instrument snapshot creation to assure we see errors (which are ignored in code)
- move tests for public `entry` types into integration tests
- rename `OperationType` to `OperationKind` as it's more commmon in Rust
- Use `Copy` where possible
- streamline implementation: remove clones and allocations, without going zero-copy
- Prefer direct calls to traits to avoid `write!("{}")` just to invoke a trait fmt implementation
- avoid `pub` when `pub(crate)` will do
- strong type for created_at
2024-05-28 13:25:46 +02:00
Sebastian Thiel
6224c70695
fix integration test structure to assure tests run only once.
Previously, tests were included by `app.rs` which is the entrypoint
for intgration tests, but there were also loose `.rs` files which
each count as separate test (with their own binary).

This wasn't intended and I don't know what happened there,
so now `core.rs` is the entrypoint.
2024-05-28 13:25:45 +02:00
Caleb Owens
571f16b8b2 Allow non-origin main branches to be listed 2024-05-24 15:22:34 +02:00
Caleb Owens
27f3b65b79 Fetch non-origin remotes 2024-05-24 14:58:56 +02:00
Kiril Videlov
1fbb756183 remove unused feature flag for snapshotting feature 2024-05-26 23:50:19 +02:00
Sebastian Thiel
f6dcf5d8c6
avoid assertions as they may cause the UI to 'hang' (#2657)
Panicked commands lead to timeouts, which are hard to debug unless
one sees the panic information in the log.
2024-05-26 08:44:55 +02:00
Kiril Videlov
762bb31dea first stab at resurecting git sync 2024-05-25 23:07:40 +02:00
Kiril Videlov
f71b76ccb4
Merge pull request #3859 from Byron/win-tempfile
minor Windows adjustments
2024-05-25 22:08:32 +02:00
Kiril Videlov
bf3611fefa feat: Add support for trailers with newlines
Escaping the newlines since the tailers are new line delimited. This is relevant when storing things like commit messages
2024-05-25 21:03:14 +02:00
Sebastian Thiel
a176bf04cf
remove Windows experiment (#3601)
The sync-all didn't do anything, and one would still run into locked
files.
2024-05-25 09:10:11 +02:00
Sebastian Thiel
9245e3458f
now_since_unix_epoch_ms now uses negative dates for times pre Unix-epoch 2024-05-25 07:45:18 +02:00
Sebastian Thiel
2ed708b298
remove chrono which was only used for 'now in milliseconds, relative to UNIX epoch' 2024-05-24 21:38:11 +02:00
Kiril Videlov
623500a25e remove unsed branch from implementation 2024-05-24 20:29:31 +02:00
Caleb Owens
4cae28668b
Merge branch 'master' into revert-3830-core-util-duration-updates 2024-05-24 14:20:55 +02:00
Caleb Owens
42a7c8bce4 Update Oplog State to better use SystemTime 2024-05-24 12:09:15 +02:00
Kiril Videlov
2ecee6df21
Merge pull request #3846 from gitbutlerapp/sc-fix-rebase-issue
Return the merge result in the case the rebase bails
2024-05-24 11:02:33 +02:00
Caleb Owens
5d723f1d91 Update comment to accuratly reflect data stored 2024-05-24 10:46:47 +02:00
Scott Chacon
c58719b77d oops. 2024-05-24 10:45:54 +02:00
Kiril Videlov
9db262936c
Merge pull request #3845 from gitbutlerapp/update-base-branch-anyhow
feat: Update base branch handling to use anyhow
2024-05-24 10:44:54 +02:00
Caleb Owens
b8a1dcb2f0
Revert "Replace integer timestamps with Duration" 2024-05-24 09:40:52 +01:00
Scott Chacon
757a4690ca return the merge result in the case the rebase bails 2024-05-24 10:38:48 +02:00
Kiril Videlov
d5ff348a21 feat: Update base branch handling to use anyhow 2024-05-24 10:31:43 +02:00
Kiril Videlov
3749bcef51 snapshot before comitting is done in two steps now
this way we have the commit id
2024-05-24 00:35:31 +02:00
Kiril Videlov
d25cd4535e prepare a snapshot before restoring from a snapshot instead of after 2024-05-24 00:23:34 +02:00
Kiril Videlov
3fef7b5474 support creating snapshots in 2 steps - prepare and commit
This allows us to create a snapshot (write the full trees state) first, perform some operations, i.e. the action taken by the user, and then finally commit the oplog.

In some cases we wanna skip comitting the oplog entry if the action done by the user fails. In some cases we might wanna save the error value as snapshot metadata.
2024-05-24 00:16:40 +02:00
Kiril Videlov
879005ae20 check lines since snapshot for all dirty branches
This is needed because new changes to a file may be locked to a branch which is not the "default" one
2024-05-23 22:37:10 +02:00
Kiril Videlov
db4bb914cc improve auto snapshotting check performance 2024-05-23 22:17:46 +02:00
Kiril Videlov
c2a5014ed0 oplog state persists timestamp of last snapshot 2024-05-23 22:17:46 +02:00
Mattias Granlund
3096a23098 run cargo fmt 2024-05-23 15:59:43 +02:00
Scott Chacon
6ccb52bd63 whoops 2024-05-23 15:59:43 +02:00
Scott Chacon
7d6c36f4de refactor: Replace manual rebase with cherry-rebase function. 2024-05-23 15:59:43 +02:00
Caleb Owens
c2a1f6a7e7 Fix various tests 2024-05-23 14:26:16 +02:00
Caleb Owens
d6cde8d722 Update comment to no longer say seconds 2024-05-23 14:09:27 +02:00
Caleb Owens
b81151c77d Rename serializer 2024-05-23 14:09:20 +02:00
Caleb Owens
4a7e5f48dd Merge origin/master into core-util-duration-updates 2024-05-23 14:04:54 +02:00
Caleb Owens
d55260c96a Use Duration rather than various integer times for time 2024-05-23 14:02:48 +02:00
Kiril Videlov
c7aaa1a6b6 fix oplog test 2024-05-23 13:40:53 +02:00
Kiril Videlov
1312813051 move snapshot MoveCommit before the operation 2024-05-23 11:59:26 +02:00
Kiril Videlov
55da2e550e move snapshot UpdateCommitMessage before the operation 2024-05-23 11:58:13 +02:00
Kiril Videlov
7ab0bbb989 move snapshot SquashCommit before the operation 2024-05-23 11:57:34 +02:00
Kiril Videlov
72cdec8c93 move snapshot CherryPick before the operation 2024-05-23 11:56:52 +02:00
Kiril Videlov
e0584534e5 move snapshot UndoCommit before the operation 2024-05-23 11:54:46 +02:00
Kiril Videlov
05039a2bbb move snapshot ReorderCommit before the operation 2024-05-23 11:54:03 +02:00
Kiril Videlov
ff04bc0a59 move snapshot InsertBlankCommit before the operation 2024-05-23 11:53:16 +02:00
Kiril Videlov
168a218ebe move snapshot MoveCommitFile before the operation 2024-05-23 11:52:27 +02:00