-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
integrate gix-status #1285
Merged
integrate gix-status #1285
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
Even though wildcard pathspecs shouldn't prevent recursion into direcotries, we should not end up declaring them as matches even though nothing inside matched.
This was referenced Feb 14, 2024
Merged
Merged
EliahKagan
added a commit
to EliahKagan/gitoxide
that referenced
this pull request
Oct 24, 2024
This change removes the `-v` option from the one `cp` invocation in `test/fixtures/many.sh`, the one fixture script that uses it. This is roughly analogous to the preceding removal of `-v` from the one `mv` invocation that used that. But while `rm -v` is standardized but only recently, `cp -v` is not standard. Even POSIX 1003.1-2024 does not require `cp` to recognize `-v`: - https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cp.html See the preceding commit for general considerations, advantages and disadvantages, and alterntive approaches. As there, this currently just drops the `-v` without replacing it with anything, based on the idea that printing the list of files being operated on (here, copied) may not be important. - That assumption may be less well-founded here, since the affected command, introduced in 482d6f3 (GitoxideLabs#1285), does *not* have other nearby `cp` commands that are conceptually related but omit `-v`. - But, unlike there, it may be reasonable to consider the `-v` here to be a (minor) bug, since it is not standardized but it appears in test fixture code that seems intended to run all targets.
EliahKagan
added a commit
to EliahKagan/gitoxide
that referenced
this pull request
Oct 24, 2024
This change removes the `-v` option from the one `cp` invocation in `test/fixtures/many.sh`, the one fixture script that uses it. This is roughly analogous to the preceding removal of `-v` from the one `mv` invocation that used that. But while `rm -v` is standardized but only recently, `cp -v` is not standard. Even POSIX 1003.1-2024 does not require `cp` to recognize `-v`: - https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cp.html See the preceding commit for general considerations, advantages and disadvantages, and alterntive approaches. As there, this currently just drops the `-v` without replacing it with anything, based on the idea that printing the list of files being operated on (here, copied) may not be important. - That assumption may be less well-founded here, since the affected command, introduced in 482d6f3 (GitoxideLabs#1285), does *not* have other nearby `cp` commands that are conceptually related but omit `-v`. - But, unlike there, it may be reasonable to consider the `-v` here to be a (minor) bug, since it is not standardized but it appears in test fixture code that seems intended to run all targets.
EliahKagan
added a commit
to EliahKagan/gitoxide
that referenced
this pull request
Oct 24, 2024
This change removes the `-v` option from the one `cp` invocation in `gix-dir/tests/fixtures/many.sh`, the one fixture script that uses it. This is roughly analogous to the preceding removal of `-v` from the one `mv` invocation that used that, and both fixture scripts are heavily used due to being used in multiple tests and due to being intentionally re-run even when `GIX_TEST_IGNORE_ARCHIVES` is not set. But while `rm -v` is standardized but only recently, `cp -v` is not standard. Even POSIX 1003.1-2024 does not require `cp` to recognize `-v`: - https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cp.html See the preceding commit for general considerations, advantages and disadvantages, and alterntive approaches. As there, this currently just drops the `-v` without replacing it with anything, based on the idea that printing the list of files being operated on (here, copied) may not be important. - That assumption may be less well-founded here, since the affected command, introduced in 482d6f3 (GitoxideLabs#1285), does *not* have other nearby `cp` commands that are conceptually related but omit `-v`. - But, unlike there, it may be reasonable to consider the `-v` here to be a (minor) bug, since it is not standardized but it appears in test fixture code that seems intended to run all targets. Taken together, this and the preceding commit allow 106 formerly failing tests to pass, on the OmniOS system I used for testing.
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 #1252
diff-correctness →
gix-status
→ gix resetImprove
gix status
to the point where it's suitable for use inreset
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
gix clean
and improve pathspec handling, i.e.*foo*
kind of matches every directorydirwalk()
intogix status
to learn more about it (and its performance)gix
crate with index-worktreediff tree with index (with reverse-diff functionality to simulate diff of index with tree), for better performance as it
would avoid having to allocate a whole index even though we are only interested in a diff.
Status Enables
gitoxide
backend Byron/built#1Next PR: Reset
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.gix index entries
to optionally expand sparse entriesgix status
with actual submodule support - needsstatus
ingix
(crate) effectivelygix status
with actual conflict supportResearch
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.Re-learn
pathspecs
normalize themselves to turn from any kind of specification into repo-root relative patterns...
and that root will be always be used to open files like../.gitignore
, which is useful for display to the user)