When using the file context menu inside a given lane to discard the changes, only the changes to that file inside the lane should be discarded.
Any other changes to that same file that live in other lanes are kept
This is relevant when all commits are equal by tree, but seem changed
due to the added GitButler headers.
For added safety, we also compare by commit message, date and authors,
basically everything that isn't the headers.
The reason for this is that now the outcome of this can be re-used in `list_virtual_branches`,
which is sensitive to seeing the latest vbranch state which is not a given.
Calculating it makes sure there is no mismatch, and probably "can't be wrong".
Also note that `head_commit()` is still kept around as it's the idea to eventually
use it more.
This was lost previously when switching it over to a read-only
implementation.
Implementing it with an ignore list will take time, 400ms in the GitLab
repository, but it's not slower than it was before and it is always
preferred to not dump objects into the ODB unnecessarily.
- move `gix` repository extension to where it belongs more naturally.
- make sure that `get_wd_tree()` is named more closely to what it really
does, and use it in more places.
It's used for emission of changed files, but also for listing
branch information.
Make sure we only run the worktree-status once to save time.
This also unifies the acquisition of the `HEAD^{commit}`,
which one day will be a natural feature once `gix::Repository`
is used.
That way, the head is static which allows to re-use the worktree status across
multiple related calls.
Also, add a way to quickly get the `head_commit()` from a `git2::Repository`.
Note that this may cause breakage in the app, as now it will see the actual
head, not a computed one, but that should also help us to find places that
didn't properly update their state.
The worktree diff is essentially a 'git status' with a given tree,
and that can be expressed with a diff of the workdir, the index and a tree.
This comes at the expense of not being able to control which file sizes are diffed.