- 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
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.
- send change_id to frontend for `RemoteCommit`
- split up massive function into three
- add a couple of checks to prevent unexpected state
- rebase if force push allowed (needs toggle)
- 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
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
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.
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.
- 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
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.
- 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.
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.
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.