Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Feat/add ignore rules #26

Merged
merged 1 commit into from
Mar 18, 2020
Merged

Conversation

corntoole
Copy link
Contributor

@corntoole corntoole commented Feb 26, 2020

This PR adds a Filter object that can be used to define rules for which files should be ignored during ipfs file commands. It also updates the serialFile type to use a filter to determine which files should be included. This is the first PR toward the re-implementation of the file ignore feature in go-ipfs: ipfs/kubo#3643

@Stebalien Stebalien requested a review from dirkmc February 26, 2020 06:32
Copy link

@dirkmc dirkmc left a comment

Choose a reason for hiding this comment

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

Thanks for helping out @corntoole!

I've made a few suggestions for code changes inline.

Could we also add a test that verifies that using a .gitignore style file works?

filter.go Outdated Show resolved Hide resolved
filter.go Outdated Show resolved Hide resolved
filter.go Outdated Show resolved Hide resolved
filter.go Outdated Show resolved Hide resolved
filter.go Outdated Show resolved Hide resolved
filter.go Outdated Show resolved Hide resolved
serialfile.go Outdated Show resolved Hide resolved
serialfile.go Show resolved Hide resolved
serialfile.go Outdated Show resolved Hide resolved
serialfile.go Outdated Show resolved Hide resolved
@corntoole
Copy link
Contributor Author

Thanks for the review @dirkmc . I just pushed a commit to address most of the suggestions, and will respond to the remaining unresolved comments shortly.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

The filtering looks good but we need to make a few changes to the integration.

serialfile.go Outdated Show resolved Hide resolved
serialfile.go Outdated Show resolved Hide resolved
@Stebalien
Copy link
Member

LGTM. Thanks! Could you rebase on master and squash? (we usually use merge commits to track PRs/features but I try to avoid reverse-merge commits).

- add a filter that defines rules for ignoring hidden and/or files
listed explicitly or defined in a gitignore file
- update SerialFile construct to accept a Filter

feat(add-file-ignore): fix tests, slight refactor

- add new SerialFile constructor with original signature for backward
compatibility
- update tests for new SerialFile behavior

feat(file-ignore):  cleanup code+tests

- address PR comments
- add more documentation
- use existing function for cross-platform hidden file detection
- be more consistent when checking for hidden fies
- add more examples+test cases

feat(file-ignore): rework `Filter` constructor

- add filter tests

feat(file-ignore): apply exclude rules lazily

- apply exclude rules from filter when iterating over dir contents
 instead of at serialFile construction time
@corntoole corntoole force-pushed the feat/add-ignore-rules branch from 8de2da5 to 90aef3a Compare March 18, 2020 03:09
@corntoole
Copy link
Contributor Author

Is this okay? I figured that you didn't mean Squash and merge since I don't have write access.

@Stebalien Stebalien merged commit 642f445 into ipfs:master Mar 18, 2020
@Stebalien
Copy link
Member

Yep. Just squash and rebase. Thanks!

hacdias pushed a commit to ipfs/boxo that referenced this pull request Jan 11, 2023
…ignore-rules

Feat/add ignore rules

This commit was moved from ipfs/go-ipfs-files@642f445
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants