Skip to content

Use gitoxide in get_status #2673

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

cruessler
Copy link
Collaborator

@cruessler cruessler commented Jun 29, 2025

Update 2025-07-06

I’ve been using this branch daily for the last week. I found one issue that I’ve addressed in a separate commit. I think it’s now ready for review!

Initial description

This is a draft PR. I think that, at this point, most of the initial work of porting is done. I’m going to be using this branch as my daily driver throughout the week to find any issues there might still be left. I’m planning on marking it as ready for review at the end of the week.

This PR changes asyncgit::sync::get_status to use gitoxide. As a side-effect, it lets gitoxide handle reading status.showUntrackedFiles. The resulting behaviour, with respect to status.showUntrackedFiles, is closer to what git does than it was before this PR. I’ve updated 2 tests according to the new behaviour.

@cruessler cruessler force-pushed the use-gitoxide-for-status branch from 2916a78 to 1b3694b Compare June 29, 2025 15:06
With this change, when `get_status` is run in a sub-directory, it also
returns matches in sub-directories that don’t share a prefix with the
sub-directory it is being run in.
@@ -123,6 +123,44 @@ pub enum Error {
#[from] gix::object::find::existing::with_conversion::Error,
),

///
#[error("gix::pathspec::init::Error error: {0}")]
GixPathspecInit(#[from] Box<gix::pathspec::init::Error>),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if this should be moved into a separate GixError Type to keep the Cambrian explosion under control with all these gix errors?

@@ -56,6 +56,13 @@ pub fn untracked_files_config_repo(
}
}

// This does not reflect how git works according to its docs that say: "If this variable is not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, we should put a reminder into your tracker issue to clean that up eventually

@@ -134,59 +177,93 @@ pub fn get_status(
) -> Result<Vec<StatusItem>> {
scope_time!("get_status");

let repo = repo(repo_path)?;
let repo: gix::Repository =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should make this a helper method as we want to make sure we always use a consistent same way to create this repo using discover_with_environment_overrides, right? we have introduced this mouthful already in a few places

Copy link
Collaborator

@extrawurst extrawurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few questions and nits, other looks good to go to me

@cruessler
Copy link
Collaborator Author

just a few questions and nits, other looks good to go to me

Great suggestions! I’ve added them as items to the tracking issue to unblock this PR. Also, I’ve already implemented one of them. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants