Commit Graph

194 Commits

Author SHA1 Message Date
Kiril Videlov
5e54e0ed01
make SNAPSHOT_LINES_THRESHOLD configurable 2024-05-04 19:34:54 +02:00
Kiril Videlov
25b7acc59c
adds a new snapshot entry type FileChanges 2024-05-04 19:19:52 +02:00
Kiril Videlov
32e5b97495 create a GbRepo trait for building blocks gitbutler uses
As well as an implementation for git2::Repository
2024-05-04 19:19:09 +02:00
Kiril Videlov
105a355e5d
fix: only skip big files from snapshotting if they are untracked 2024-05-04 16:28:34 +02:00
Kiril Videlov
9aee55c869
tiny cli for snapshots
this is a cli convinience tool for listing and restoring gitbutler snapshots even if the app can't start or if it's hung. of course this can be done with plain git, but this is more convinient

In the future we could add more functionality to it
2024-05-04 11:29:14 +02:00
Kiril Videlov
8ef46ce42c
snapshots: use subtrees for virtual_branches.toml
Instead of copying the file to the working directory, simply create a top level tree with a subtree for the workdir and a blob for the toml file
2024-05-03 11:13:55 +02:00
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
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
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
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
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
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