- 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.