-
-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
status support in gix
(crate)
#1049
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Byron
force-pushed
the
gix-status
branch
3 times, most recently
from
October 10, 2023 05:45
d0eef9a
to
ad5f6b7
Compare
Byron
force-pushed
the
gix-status
branch
3 times, most recently
from
October 19, 2023 06:04
ed94986
to
7911093
Compare
Byron
force-pushed
the
gix-status
branch
6 times, most recently
from
October 30, 2023 15:22
9f828e4
to
b9b21f3
Compare
Byron
force-pushed
the
gix-status
branch
4 times, most recently
from
November 1, 2023 19:58
539a295
to
339a6c1
Compare
Byron
force-pushed
the
gix-status
branch
6 times, most recently
from
November 6, 2023 12:48
630899e
to
52b2859
Compare
As opposed to the Rust standard library, this one will get the ctime from the file itself, instead of from the inode. That way, the index file written by `gix` will not continuously be expensively rewritten by `git`, and vice versa.
They generalize reneame tracking to the point where it can work for different kinds of changes. There is still some way to go until it is truly correct though, as it still lacks worktree conversions and diff filters.
Previously the rename tracking engine was integrated with tree-diffs, but already operates in a stand-alone fashion. Now it's officially generalized which allows it to be tested separately and used when tracking renames for diffs between index and tree, index and index, and index and worktree.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #1030
Improve
gix status
to the point where it's suitable for use in reset functinoality.Leads to a proper worktree reset implementation, eventually leading to a high-level reset similar to how git supports it.
Architecture
The reason this PR deals quite a bit with
gix status
is that for a safe implementation ofreset()
we need to be sure that the files we would want to touch don't don't carry modifications or are untracked files. In order to know what would need to be done, we have to diff thecurrent-index with target-index
. The set of files to touch can then be used to lookup information provided bygit-status
, like worktree modifications, index modifications, and untracked files, to know if we can proceed or not. Here is also where the reset-modes would affect the outcome, i.e. what to change and how.This is a very modular approach which facilitates testing and understanding of what otherwise would be a very complex algorithm. Having a set of changes as output also allows to one day parallelize applying these changes.
This leaves us in a situation where the current
checkout()
implementation wants to become a fastpath for situations where the reset involves an empty tree as source (i.e. create everything and overwrite local changes).On the way to
reset()
it's a valid choice to warm up more with the matter by improving on the currentgix status
implementation and assure correctness of what's there, which currently doesn't seem to be the case in comparison. Further, implementinggix status
similarly togit status
should be made possible.Tasks
ctime
issue.gix_status::fs
togix_index
and assure this form of metadata-retrieval is used everywhere (e.g. checkout…).gix-fs
behind feature toggle) due to the per-platform dependenciestextconv
, and gitattributes integrationgix
cratecat-file
equivalent, and possiblytextconv
conversions just like in `git cat-file.Next PR
reset()
that checks if it's allowed to perform a worktree modification is allowed, or if an entry should be skipped. That way we can postpone safety checks like --hardPostponed
What follows is important for resets, but won't be needed for
cargo
worktree resets.git2
can do that. Needs generalization of what's available fortree/tree
diffs, at least learn from it.gix status
with actual submodule support - needsstatus
ingix
(crate) effectivelygix status
with actual conflict supportLimitations
git
will rewrite that next time it runs. This can be fixed withcore.trustCTime=false
Research
gix status
can deal a little better with submodules. Even though in this case a lot of submodule-related information is needed for a complete reset, probably only doable by a higher-level caller which orchestrates it.merge
andkeep
? How to controlrefresh
? Maybe partial (only the files we touch), and full, to also update the files we don't touch as part of status? Maybe it's part of status if that is run before.git reset
andgit checkout
in terms ofHEAD
modifications. With the former changingHEAD
s referent, and the latter changingHEAD
itself.checkout()
method as technically that's areset --hard
with optional overwrite check. Could it be rolled into one, with pathspec support added?reset()
performs just as well, which is unlikely as there is more overhead. But maybe it's not worth to maintain two versions over it. But if so, one should probably rename it.git status
: what about rename tracking? It's available for tree-diffs and quite complex on its own. Probably only needs HEAD-vs-index rename tracking. No, also can have worktree rename tracking, even though it's hard to imagine how this can be fast unless it's tightly integrated with untracked-files handling. This screams for a generalization of the tracking code though as the testing and implementation is complex, but should be generalisable.