Skip to content
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

Ignore non-regular files #1629

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

krobelus
Copy link

(very much unfinished, I will probably finish it later this week).

My "mkfifo fifo && cargo publish" hangs because cargo tries to tar
the fifo as well. This is surprising because neither "git status"
nor "git check-ignore -v fifo" list the untracked fifo.

Fifo type files are completely ignored by Git since commit 8695c8b
(Add "show-files" command to show the list of managed (or non-managed)
files., 2005-04-11) which states the reason:

  • [...] We currently ignore anything but
  • directories and regular files. That's because git doesn't
  • handle them at all yet. Maybe that will change some day.

It didn't change yet[*]. Try to match Git to minimize surprise.
Combined with some extra error handling, this enables some cleanup.

[*] But the logic from read_directory() has moved into treat_path().

(very much unfinished, I will probably finish it later this week).

My "mkfifo fifo && cargo publish" hangs because cargo tries to tar
the fifo as well.  This is surprising because neither "git status"
nor "git check-ignore -v fifo" list the untracked fifo.

Fifo type files are completely ignored by Git since commit 8695c8b
(Add "show-files" command to show the list of managed (or non-managed)
files., 2005-04-11) which states the reason:

> * [...] We currently ignore anything but
> * directories and regular files. That's because git doesn't
> * handle them at all yet. Maybe that will change some day.

It didn't change yet[*]. Try to match Git to minimize surprise.
Combined with some extra error handling, this enables some cleanup.

[*] But the logic from read_directory() has moved into treat_path().
Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

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

Thanks a lot for tackling this!

I am surprised these seemingly sweeping changes are needed when trying to ignored 'special' files, but would always be open to improvements. And changing Option<bool> to bool certainly counts as such.

However, I need this PR to change in structure so that…

  • …there is one commit per crate when dealing with plumbing crates.
    • if there is a breaking change, that must be indicated as conventional commit message. That's critical to the release process.
  • …there is one commit over all changes necessary to adapt to breaking changes (i.e. make it compile after breaking plumbing changes).

I already left a couple of comments, maybe it's too early though and in that case, please ignore.

It's really important to reorganise the commits before continuing though.

Thank you

gix-dir/src/walk/readdir.rs Show resolved Hide resolved
.map_or(false, |platform| platform.matching_attributes(out))
},
)
.pattern_matching_relative_path(path, true, &mut |relative_path, case, is_dir, out| {
Copy link
Member

Choose a reason for hiding this comment

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

I don't get why this defaults to true now, and would hope there is a test to catch it. If not, definitely a reason to add a couple, probably including a baseline to validate Git works similarly.

match Kind::try_from(m.file_type()) {
Ok(kind) => kind,
Err(_err) => {
continue;
Copy link
Author

Choose a reason for hiding this comment

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

I am surprised these seemingly sweeping changes are needed when trying to ignored 'special' files

Yeah they're not, the only change that's needed is this "continue", which should probably be its own commit.

But I believe other places can be simplified and made more consistent. I may be wrong, I just need to find time to finish it

Copy link
Member

Choose a reason for hiding this comment

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

One will definitely need tests for that as well, and in the crates you are working in, they are basically done in a test-driven fashion exclusively as the code is way to complex to understand exactly what's going to happen.
But with the re-organization of commits I think all this will come quite naturally.

@krobelus
Copy link
Author

Sorry I got busy with other stuff, I'm not sure when I'll get around to this.
Probably we can make a minimal fix and handle the rest later.

@Byron
Copy link
Member

Byron commented Oct 29, 2024

No worries- do what you can, and I will pick it up asap as well.

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.

2 participants