Find all paths in the specified directory that are ignored by .gitignore files
Project description
gitignore-find
查找指定目录下所有被.gitignore文件忽略的路径,功能与git check-ignore **/*类似:
- 允许指定多个目录并检查其中所有的
.gitignore文件 - 被
.gitignore文件忽略的路径会尝试合并避免路径过多 - 超级快!
常见的用法是找出home目录下所有git仓库下忽略的目录用于从备份目录中排除
安装
目前只提供python扩展,使用pip从pypi安装
pip install gitignore-find
提供了一个简单的命令行程序find但只能使用源码构建
cargo build --example find -r
运行
import gitignore_find
import logging
logging.basicConfig(level=5)
# logging.basicConfig(level=logging.DEBUG)
ignoreds = gitignore_find.find_ignoreds(
["."],
excludes=["**/.git/**", "**/.cargo", "**/.vscode*", "**/.env"],
)
print("\n".join(ignoreds))
性能
在6核9750H SSD设备 wsl debian中运行下面是测试示例从home目录60万个路径中的1061个.gitignore文件找出忽略路径的用时是5秒左右,如果有缓存可以减少到2秒不到
$ hyperfine --warmup 3 'target/release/examples/find ~'
Benchmark 1: target/release/examples/find ~
Time (mean ± σ): 1.813 s ± 0.072 s [User: 9.317 s, System: 3.497 s]
Range (min … max): 1.743 s … 1.945 s 10 runs
$ hyperfine --prepare 'sync; echo 3 | sudo -n tee /proc/sys/vm/drop_caches' 'target/release/examples/find ~'
Benchmark 1: target/release/examples/find ~
Time (mean ± σ): 5.167 s ± 0.179 s [User: 12.203 s, System: 11.762 s]
Range (min … max): 4.875 s … 5.557 s 10 runs
$ echo 3 | sudo -n tee /proc/sys/vm/drop_caches >/dev/null; time target/release/examples/find ~ >/dev/null
[2024-12-01T04:46:54.270Z DEBUG gitignore_find] Finding git ignored paths with exclude globs [] in 1 paths: ["/home/navyd"]
[2024-12-01T04:46:54.270Z DEBUG gitignore_find] Finding all paths in /home/navyd
[2024-12-01T04:46:54.270Z TRACE gitignore_find] Traversing paths in directory /home/navyd
[2024-12-01T04:46:57.577Z TRACE gitignore_find] Found 611706 paths for /home/navyd
[2024-12-01T04:46:57.984Z DEBUG gitignore_find] Finding ignored paths with 1061 gitignores and exclude pattern GlobPathPattern { patterns: [] } in /home/navyd
[2024-12-01T04:46:58.831Z DEBUG gitignore_find] Found 120054 ignored paths for all paths "/home/navyd"
[2024-12-01T04:46:58.851Z TRACE gitignore_find] Getting sub paths from 120054 ignoreds paths
[2024-12-01T04:46:59.241Z TRACE gitignore_find] Traversing all sub paths of 1061 .gitignore paths
[2024-12-01T04:46:59.252Z DEBUG gitignore_find] Merging 120054 ignored paths
[2024-12-01T04:46:59.330Z DEBUG gitignore_find] Found 984 ignored paths for ["/home/navyd"]
target/release/examples/find ~ > /dev/null 11.92s user 11.44s system 460% cpu 5.074 total
avg shared (code): 0 KB
avg unshared (data/stack): 0 KB
total (sum): 0 KB
max memory: 207 MB
page faults from disk: 33
other page faults: 2994
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitignore_find-1.2.0.tar.gz.
File metadata
- Download URL: gitignore_find-1.2.0.tar.gz
- Upload date:
- Size: 32.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
513e3b3127fe3b1d1dafaba18476d5035ddb1f4c96a072ae328f367e7a0f2032
|
|
| MD5 |
84d65fa2defb4e7cd7d5599a0a589864
|
|
| BLAKE2b-256 |
2fd8d8e77dcd3ab55945006e232da2035ea8bf00de60f58a3747f6cb35200ac4
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 885.0 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02ab5d0b85e8e66098c74750929f612fcdebec391f92ec49280fbfa1d82e237e
|
|
| MD5 |
00b54c604d645f6f86e0df1372a7eaf4
|
|
| BLAKE2b-256 |
34416db51a81209996b7dc0237bd190b3e666a3c02ba5abe9961eec38a578851
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-win32.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-win32.whl
- Upload date:
- Size: 786.5 kB
- Tags: CPython 3.9+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a8be571c4f964da97d683e7329ddf989d894b364735fc267c67c3e1d3944215
|
|
| MD5 |
7789ac4cbbefe084627b77223901e55c
|
|
| BLAKE2b-256 |
13144c9640a82b2bd496154d1c5970cf3a1e5769f06b9971b70e1d0c7e0e2fd9
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8419918d87a4f619978244a2ec194dc338d7236c168b3c34ec7929a10d368de
|
|
| MD5 |
95a4bf457368800baa84640d0f102725
|
|
| BLAKE2b-256 |
22adfb4804630a03d0070b5329c6beeca24a1f80533b4ac752ad1a1fc8526fee
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-musllinux_1_2_i686.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-musllinux_1_2_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a5be7e534680db3f70d4907b348d5fbafed011ae1bc60a649cc81732376b2a1
|
|
| MD5 |
f6b06da2fc4762ea1dc8d1338f4796e5
|
|
| BLAKE2b-256 |
8e2b445d6dc99ed91b4657e32d26838085bb96700712199957628015a7e6fbeb
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
420feb58714d4a5af84f5cd201b135d7d90bd3542445b5abdf56820efa6cb8aa
|
|
| MD5 |
92e0c4761aa67c127c82f2d72382cceb
|
|
| BLAKE2b-256 |
72522e115412d992624a8bdd1de36f1fabf17ce789c0c451555714dafaf27e98
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5e3b73e67599f54985cbf2f6e1d024f36e5ad83edaf2420440b11983b765e79
|
|
| MD5 |
c25c4fec5ead048cbca47309e4a6ada7
|
|
| BLAKE2b-256 |
6ef71e8ddecf62ba9c6e15b9813bf7d3a224645138779d2e9699ca4d6db3988e
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7b7ad6700dcdcad0fbcf5c8f0bfe5947a5060566db1a11b711bfc4c58b5da7d
|
|
| MD5 |
041d1b29fc923788e60559112e12bf20
|
|
| BLAKE2b-256 |
8fe768591c320a250cd5c32e244b96b80074590fe5f5efea3316a54f98a59644
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
241d286a3500bbc7e04cfd7f76b70e1765141f5fad2876c3857d31cdf0132de0
|
|
| MD5 |
403251c4b3c1836a038c5924b5dcdf29
|
|
| BLAKE2b-256 |
6c9837088a41d1be06bd9c549f0f588176bb8f7c5633b23dfa80d10623d191e7
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9eb8700eb226481d40bdae63c088bc4a38e7d59a6fe69d0a4b65ec19b578762c
|
|
| MD5 |
5cc4d119512c4892c3f5dfc09da71dfd
|
|
| BLAKE2b-256 |
86612197a80eddda19725c6224007591c756f10b7f2260f4f9d557092bc03da9
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0628eb9875ba892f665af9931fc3aa9a34e0b79ed4f10870b5caa6f07a7e9a9e
|
|
| MD5 |
84fd7a92386444464eeb716df0f59bd0
|
|
| BLAKE2b-256 |
5afdc9de53a805a361357e546a34bf72be86d57d7ee68eb79bb4db473c04782a
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6098f26dbdbb15207c9709dbb727323a03b84c8b32eeadcaf37216c811fea048
|
|
| MD5 |
313ee06df3682bbb7e6ffdfea521f118
|
|
| BLAKE2b-256 |
3796f164360ad16db6ff2fec79483fcb0aee07d94cbdb79555e4258341cf6210
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb607cfbd5d3f94766c6f70d00bb33bbe15baf3770288f8e48f56a08a6511e0d
|
|
| MD5 |
7683013b2791d8f18fe35f5e72ece5f4
|
|
| BLAKE2b-256 |
0152e81e436a598e3be6b6d050fb80bf32ac22902504e87ce7afcb5e0fec9c0c
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 975.8 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbf7325b6c33739026458ea0bd255eb88b420fb6efcd07cf844d0d4f4b739a65
|
|
| MD5 |
60c9ec9b452285fa252c00bdd5098c86
|
|
| BLAKE2b-256 |
540c95df790fa75c06afb086c01321344479c8a8d5f42f665e90810ee8c0ba86
|
File details
Details for the file gitignore_find-1.2.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: gitignore_find-1.2.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e61fbdffcd3b7f414b949e144739e5add35b5e0a7dcc11f7e3fcc125a8d41d8
|
|
| MD5 |
f24b736864c916beb55897a8a8df71d7
|
|
| BLAKE2b-256 |
de979f9119aff10f0a9ac18e71b44632f2fe04edf2370a4ec2348ce8ffa96212
|