mirror of
https://github.com/j178/prek.git
synced 2026-04-25 02:11:36 +02:00
Rename project name to prefligit (#118)
* Rename project to `prefligit` * Bump to 0.0.6 * Fix tests * Add a rename note
This commit is contained in:
@@ -54,11 +54,11 @@ jobs:
|
||||
set -euo pipefail
|
||||
|
||||
TARGET=${{ matrix.platform.target }}
|
||||
ARCHIVE_NAME=pre-commit-rs-$TARGET
|
||||
ARCHIVE_NAME=prefligit-$TARGET
|
||||
ARCHIVE_FILE=$ARCHIVE_NAME.tar.gz
|
||||
|
||||
mkdir -p $ARCHIVE_NAME
|
||||
cp target/$TARGET/release/pre-commit $ARCHIVE_NAME/pre-commit
|
||||
cp target/$TARGET/release/prefligit $ARCHIVE_NAME/prefligit
|
||||
tar czvf $ARCHIVE_FILE $ARCHIVE_NAME
|
||||
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
|
||||
- name: "Upload binary"
|
||||
@@ -92,8 +92,8 @@ jobs:
|
||||
- name: "Archive binary"
|
||||
shell: bash
|
||||
run: |
|
||||
ARCHIVE_FILE=pre-commit-rs-${{ matrix.platform.target }}.zip
|
||||
7z a $ARCHIVE_FILE ./target/${{ matrix.platform.target }}/release/pre-commit.exe
|
||||
ARCHIVE_FILE=prefligit-${{ matrix.platform.target }}.zip
|
||||
7z a $ARCHIVE_FILE ./target/${{ matrix.platform.target }}/release/prefligit.exe
|
||||
sha256sum $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
|
||||
- name: "Upload binary"
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -128,11 +128,11 @@ jobs:
|
||||
- name: "Archive binary"
|
||||
run: |
|
||||
TARGET=${{ matrix.platform.target }}
|
||||
ARCHIVE_NAME=pre-commit-rs-$TARGET
|
||||
ARCHIVE_NAME=prefligit-$TARGET
|
||||
ARCHIVE_FILE=$ARCHIVE_NAME.tar.gz
|
||||
|
||||
mkdir -p $ARCHIVE_NAME
|
||||
cp target/$TARGET/release/pre-commit $ARCHIVE_NAME/pre-commit
|
||||
cp target/$TARGET/release/prefligit $ARCHIVE_NAME/prefligit
|
||||
tar czvf $ARCHIVE_FILE $ARCHIVE_NAME
|
||||
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
|
||||
- name: "Upload binary"
|
||||
|
||||
@@ -57,19 +57,19 @@ jobs:
|
||||
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
|
||||
- name: Copy Git Repo to Dev Drive
|
||||
run: |
|
||||
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.PRE_COMMIT_WORKSPACE }}" -Recurse
|
||||
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.PREFLIGIT_WORKSPACE }}" -Recurse
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
# Add a key to invalidate previous caches.
|
||||
key: 1
|
||||
workspaces: ${{ env.PRE_COMMIT_WORKSPACE }}
|
||||
workspaces: ${{ env.PREFLIGIT_WORKSPACE }}
|
||||
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup component add clippy
|
||||
|
||||
- name: "Clippy"
|
||||
working-directory: ${{ env.PRE_COMMIT_WORKSPACE }}
|
||||
working-directory: ${{ env.PREFLIGIT_WORKSPACE }}
|
||||
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
|
||||
|
||||
cargo-shear:
|
||||
@@ -151,14 +151,14 @@ jobs:
|
||||
# actions/checkout does not let us clone into anywhere outside ${{ github.workspace }}, so we have to copy the clone...
|
||||
- name: Copy Git Repo to Dev Drive
|
||||
run: |
|
||||
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.PRE_COMMIT_WORKSPACE }}" -Recurse
|
||||
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.PREFLIGIT_WORKSPACE }}" -Recurse
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: ${{ env.PRE_COMMIT_WORKSPACE }}
|
||||
workspaces: ${{ env.PREFLIGIT_WORKSPACE }}
|
||||
|
||||
- name: "Install Rust toolchain"
|
||||
working-directory: ${{ env.PRE_COMMIT_WORKSPACE }}
|
||||
working-directory: ${{ env.PREFLIGIT_WORKSPACE }}
|
||||
run: rustup show
|
||||
|
||||
- name: "Install cargo nextest"
|
||||
@@ -172,7 +172,7 @@ jobs:
|
||||
cache-local-path: ${{ env.DEV_DRIVE }}/uv-cache
|
||||
|
||||
- name: "Cargo test"
|
||||
working-directory: ${{ env.PRE_COMMIT_WORKSPACE }}
|
||||
working-directory: ${{ env.PREFLIGIT_WORKSPACE }}
|
||||
run: |
|
||||
cargo nextest show-config test-groups
|
||||
cargo nextest run --workspace --status-level skip --failure-output immediate --no-fail-fast -j 8 --final-status-level slow
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# This creates a 10GB dev drive, and exports all required environment
|
||||
# variables so that rustup, pre-commit and others all use the dev drive as much
|
||||
# variables so that rustup, prefligit and others all use the dev drive as much
|
||||
# as possible.
|
||||
$Volume = New-VHD -Path C:/pre-commit_dev_drive.vhdx -SizeBytes 10GB |
|
||||
$Volume = New-VHD -Path C:/prefligit_dev_drive.vhdx -SizeBytes 10GB |
|
||||
Mount-VHD -Passthru |
|
||||
Initialize-Disk -Passthru |
|
||||
New-Partition -AssignDriveLetter -UseMaximumSize |
|
||||
@@ -10,7 +10,7 @@ $Volume = New-VHD -Path C:/pre-commit_dev_drive.vhdx -SizeBytes 10GB |
|
||||
Write-Output $Volume
|
||||
|
||||
$Drive = "$($Volume.DriveLetter):"
|
||||
$Tmp = "$($Drive)/pre-commit-tmp"
|
||||
$Tmp = "$($Drive)/prefligit-tmp"
|
||||
|
||||
# Create the directory ahead of time in an attempt to avoid race-conditions
|
||||
New-Item $Tmp -ItemType Directory
|
||||
@@ -19,8 +19,8 @@ Write-Output `
|
||||
"DEV_DRIVE=$($Drive)" `
|
||||
"TMP=$($Tmp)" `
|
||||
"TEMP=$($Tmp)" `
|
||||
"PRE_COMMIT_INTERNAL__TEST_DIR=$($Tmp)" `
|
||||
"PREFLIGIT_INTERNAL__TEST_DIR=$($Tmp)" `
|
||||
"RUSTUP_HOME=$($Drive)/.rustup" `
|
||||
"CARGO_HOME=$($Drive)/.cargo" `
|
||||
"PRE_COMMIT_WORKSPACE=$($Drive)/pre-commit" `
|
||||
"PREFLIGIT_WORKSPACE=$($Drive)/prefligit" `
|
||||
>> $env:GITHUB_ENV
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
# Changelog
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Breaking changes
|
||||
|
||||
In this release, we’ve renamed the project to `prefligit` (a deliberate misspelling of preflight) to prevent confusion with the existing pre-commit tool. For further information, refer to issue #73.
|
||||
|
||||
- The command-line name is now `prefligit`. We suggest uninstalling any previous version of `pre-commit-rs` and installing `prefligit` from scratch.
|
||||
- The PyPI package is now listed as [`prefligit`](https://pypi.org/project/prefligit/).
|
||||
- The Cargo package is also now [`prefligit`](https://crates.io/crates/prefligit).
|
||||
- The Homebrew formula has been updated to `prefligit`.
|
||||
|
||||
### Enhancements
|
||||
|
||||
- Support `docker_image` language ([#113](https://github.com/j178/pre-commit-rs/pull/113))
|
||||
- Support `init-templatedir` subcommand ([#101](https://github.com/j178/pre-commit-rs/pull/101))
|
||||
- Implement get filenames from merge conflicts ([#103](https://github.com/j178/pre-commit-rs/pull/103))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- Fix `prefligit install --hook-type` name ([#102](https://github.com/j178/pre-commit-rs/pull/102))
|
||||
|
||||
### Other changes
|
||||
|
||||
- Apply color option to log ([#100](https://github.com/j178/pre-commit-rs/pull/100))
|
||||
- Improve tests ([#106](https://github.com/j178/pre-commit-rs/pull/106))
|
||||
- Remove intermedia Language enum ([#107](https://github.com/j178/pre-commit-rs/pull/107))
|
||||
- Run `cargo clippy` in the dev drive workspace ([#115](https://github.com/j178/pre-commit-rs/pull/115))
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Enhancements
|
||||
|
||||
Generated
+107
-112
@@ -292,9 +292,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.8.0"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da"
|
||||
checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
|
||||
|
||||
[[package]]
|
||||
name = "camino"
|
||||
@@ -307,9 +307,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.1"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47"
|
||||
checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc"
|
||||
dependencies = [
|
||||
"shlex",
|
||||
]
|
||||
@@ -516,12 +516,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.9"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
|
||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -762,9 +762,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.15.1"
|
||||
version = "0.15.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
|
||||
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
|
||||
|
||||
[[package]]
|
||||
name = "hashlink"
|
||||
@@ -781,12 +781,6 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.4.0"
|
||||
@@ -1078,12 +1072,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.6.0"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
||||
checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.15.1",
|
||||
"hashbrown 0.15.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1160,7 +1154,7 @@ version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
|
||||
dependencies = [
|
||||
"hermit-abi 0.4.0",
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
@@ -1182,16 +1176,17 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.13"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2"
|
||||
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.72"
|
||||
version = "0.3.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
|
||||
checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
@@ -1203,9 +1198,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.164"
|
||||
version = "0.2.167"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f"
|
||||
checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc"
|
||||
|
||||
[[package]]
|
||||
name = "libsqlite3-sys"
|
||||
@@ -1232,9 +1227,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
|
||||
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.7.3"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704"
|
||||
checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
@@ -1324,11 +1319,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.0.2"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
|
||||
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
|
||||
dependencies = [
|
||||
"hermit-abi 0.3.9",
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-sys 0.52.0",
|
||||
@@ -1474,9 +1468,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "1.9.0"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
|
||||
checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
|
||||
|
||||
[[package]]
|
||||
name = "pprof"
|
||||
@@ -1510,8 +1504,38 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pre-commit-rs"
|
||||
version = "0.0.5"
|
||||
name = "predicates"
|
||||
version = "3.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"difflib",
|
||||
"float-cmp",
|
||||
"normalize-line-endings",
|
||||
"predicates-core",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "predicates-core"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931"
|
||||
|
||||
[[package]]
|
||||
name = "predicates-tree"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13"
|
||||
dependencies = [
|
||||
"predicates-core",
|
||||
"termtree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prefligit"
|
||||
version = "0.0.6"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anyhow",
|
||||
@@ -1560,41 +1584,11 @@ dependencies = [
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "predicates"
|
||||
version = "3.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"difflib",
|
||||
"float-cmp",
|
||||
"normalize-line-endings",
|
||||
"predicates-core",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "predicates-core"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931"
|
||||
|
||||
[[package]]
|
||||
name = "predicates-tree"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13"
|
||||
dependencies = [
|
||||
"predicates-core",
|
||||
"termtree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.91"
|
||||
version = "1.0.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "307e3004becf10f5a6e0d59d20f3cd28231b0e0827a96cd3e0ce6d14bc1e4bb3"
|
||||
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -1860,9 +1854,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.0.0"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
|
||||
checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
@@ -1879,9 +1873,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.17"
|
||||
version = "0.23.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f1a745511c54ba6d4465e8d5dfbd81b45791756de28d4981af70d6dca128f1e"
|
||||
checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"ring",
|
||||
@@ -2068,9 +2062,9 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.7"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
|
||||
checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
@@ -2108,9 +2102,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
||||
|
||||
[[package]]
|
||||
name = "symbolic-common"
|
||||
version = "12.12.1"
|
||||
version = "12.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d4d73159efebfb389d819fd479afb2dbd57dcb3e3f4b7fcfa0e675f5a46c1cb"
|
||||
checksum = "e5ba5365997a4e375660bed52f5b42766475d5bc8ceb1bb13fea09c469ea0f49"
|
||||
dependencies = [
|
||||
"debugid",
|
||||
"memmap2",
|
||||
@@ -2120,9 +2114,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "symbolic-demangle"
|
||||
version = "12.12.1"
|
||||
version = "12.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a767859f6549c665011970874c3f541838b4835d5aaaa493d3ee383918be9f10"
|
||||
checksum = "beff338b2788519120f38c59ff4bb15174f52a183e547bac3d6072c2c0aa48aa"
|
||||
dependencies = [
|
||||
"cpp_demangle",
|
||||
"rustc-demangle",
|
||||
@@ -2131,9 +2125,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.89"
|
||||
version = "2.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e"
|
||||
checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2300,9 +2294,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.40"
|
||||
version = "0.1.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
|
||||
dependencies = [
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
@@ -2311,9 +2305,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.27"
|
||||
version = "0.1.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
||||
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2322,9 +2316,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.32"
|
||||
version = "0.1.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
|
||||
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
@@ -2343,9 +2337,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.18"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
|
||||
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
|
||||
dependencies = [
|
||||
"matchers",
|
||||
"nu-ansi-term",
|
||||
@@ -2403,9 +2397,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.3"
|
||||
version = "2.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada"
|
||||
checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
@@ -2491,9 +2485,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.95"
|
||||
version = "0.2.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
|
||||
checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -2502,9 +2496,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.95"
|
||||
version = "0.2.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
|
||||
checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
@@ -2517,21 +2511,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.45"
|
||||
version = "0.4.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
|
||||
checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.95"
|
||||
version = "0.2.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
|
||||
checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -2539,9 +2534,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.95"
|
||||
version = "0.2.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
|
||||
checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2552,15 +2547,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.95"
|
||||
version = "0.2.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
|
||||
checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.72"
|
||||
version = "0.3.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
|
||||
checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -2578,9 +2573,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.26.6"
|
||||
version = "0.26.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958"
|
||||
checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
@@ -2885,9 +2880,9 @@ checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
|
||||
|
||||
[[package]]
|
||||
name = "yoke"
|
||||
version = "0.7.4"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5"
|
||||
checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"stable_deref_trait",
|
||||
@@ -2897,9 +2892,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yoke-derive"
|
||||
version = "0.7.4"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95"
|
||||
checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -2930,18 +2925,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55"
|
||||
checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
|
||||
dependencies = [
|
||||
"zerofrom-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom-derive"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5"
|
||||
checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
+5
-9
@@ -1,19 +1,15 @@
|
||||
[package]
|
||||
name = "pre-commit-rs"
|
||||
version = "0.0.5"
|
||||
name = "prefligit"
|
||||
version = "0.0.6"
|
||||
authors = ["j178 <hi@j178.dev>"]
|
||||
description = "pre-commit implemeneted in Rust"
|
||||
repository = "https://github.com/j178/pre-commit-rs"
|
||||
homepage = "https://github.com/j178/pre-commit-rs"
|
||||
repository = "https://github.com/j178/prefligit"
|
||||
homepage = "https://github.com/j178/prefligit"
|
||||
edition = "2021"
|
||||
license-file = "LICENSE"
|
||||
# `cargo publish` failed because of this, disabled for now.
|
||||
# include = ["licenses/.*"]
|
||||
|
||||
[[bin]]
|
||||
path = "src/main.rs"
|
||||
name = "pre-commit"
|
||||
|
||||
[features]
|
||||
default = ["docker"]
|
||||
profiler = ["dep:pprof", "profiler-flamegraph"]
|
||||
@@ -143,7 +139,7 @@ publish-jobs = ["./publish", "homebrew"]
|
||||
# A GitHub repo to push Homebrew formulas to
|
||||
tap = "j178/homebrew-tap"
|
||||
# Customize the Homebrew formula name
|
||||
formula = "pre-commit-rs"
|
||||
formula = "prefligit"
|
||||
# Whether to install an updater program
|
||||
install-updater = false
|
||||
# Path that installers should place binaries in
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# pre-commit-rs
|
||||
# prefligit
|
||||
|
||||

|
||||
[](https://github.com/j178/pre-commit-rs/actions/workflows/ci.yml)
|
||||
[](https://github.com/j178/prefligit/actions/workflows/ci.yml)
|
||||
|
||||
A reimplementation of the [pre-commit](https://pre-commit.com/) tool in Rust, providing a faster and dependency-free alternative.
|
||||
It aims to be a drop-in replacement for the original tool while also providing some more advanced features.
|
||||
@@ -10,6 +10,10 @@ It aims to be a drop-in replacement for the original tool while also providing s
|
||||
> This project is still in very early development, only a few of the original pre-commit features are implemented.
|
||||
> It is not recommended for normal use yet, but feel free to try it out and provide feedback.
|
||||
|
||||
> [!NOTE]
|
||||
> This project was previously named `pre-commit-rs`, but it was renamed to `prefligit` to prevent confusion with the existing pre-commit tool.
|
||||
> See #73 for more information.
|
||||
|
||||
## Features
|
||||
|
||||
- A single binary with no dependencies, does not require Python or any other runtime.
|
||||
@@ -23,37 +27,37 @@ It aims to be a drop-in replacement for the original tool while also providing s
|
||||
|
||||
### Standalone installer
|
||||
|
||||
`pre-commit-rs` provides a standalone installer script to download and install the tool:
|
||||
`prefligit` provides a standalone installer script to download and install the tool:
|
||||
|
||||
```console
|
||||
# On Linux and macOS
|
||||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/pre-commit-rs/releases/download/v0.0.5/pre-commit-rs-installer.sh | sh
|
||||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prefligit/releases/download/v0.0.6/prefligit-installer.sh | sh
|
||||
|
||||
# On Windows
|
||||
powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/pre-commit-rs/releases/download/v0.0.5/pre-commit-rs-installer.ps1 | iex"
|
||||
powershell -ExecutionPolicy ByPass -c "irm https://github.com/j178/prefligit/releases/download/v0.0.6/prefligit-installer.ps1 | iex"
|
||||
```
|
||||
|
||||
### PyPI
|
||||
|
||||
`pre-commit-rs` is published as Python binary wheel to PyPI under the name `pre-commit-rusty`,
|
||||
`prefligit` is published as Python binary wheel to PyPI under the name `pre-commit-rusty`,
|
||||
you can install it using `pip`, `uv` (recommended), or `pipx`:
|
||||
|
||||
```console
|
||||
pip install pre-commit-rusty
|
||||
pip install prefligit
|
||||
|
||||
# or
|
||||
|
||||
uv tool install pre-commit-rusty
|
||||
uv tool install prefligit
|
||||
|
||||
# or
|
||||
|
||||
pipx install pre-commit-rusty
|
||||
pipx install prefligit
|
||||
```
|
||||
|
||||
### Homebrew
|
||||
|
||||
```console
|
||||
brew install j178/tap/pre-commit-rs
|
||||
brew install j178/tap/prefligit
|
||||
```
|
||||
|
||||
### Cargo
|
||||
@@ -61,24 +65,21 @@ brew install j178/tap/pre-commit-rs
|
||||
Build from source using Cargo:
|
||||
|
||||
```console
|
||||
cargo install --locked pre-commit-rs
|
||||
cargo install --locked prefligit
|
||||
```
|
||||
|
||||
Install from the binary directly using `cargo binstall`:
|
||||
|
||||
```console
|
||||
cargo binstall pre-commit-rs
|
||||
cargo binstall prefligit
|
||||
```
|
||||
|
||||
### GitHub Releases
|
||||
|
||||
`pre-commit-rs` release artifacts can be downloaded directly from the [GitHub releases](https://github.com/j178/pre-commit-rs/releases).
|
||||
`prefligit` release artifacts can be downloaded directly from the [GitHub releases](https://github.com/j178/prefligit/releases).
|
||||
|
||||
## Usage
|
||||
|
||||
> [!NOTE]
|
||||
> The binary executable is named `pre-commit` (or `pre-commit.exe` on Windows) - without the `-rs` suffix. It should be available in your `PATH` after installation.
|
||||
|
||||
This tool is designed to be a drop-in replacement for the original pre-commit tool, so you can use it with your existing configurations and hooks.
|
||||
|
||||
Please refer to the [official documentation](https://pre-commit.com/) for more information on how to configure and use pre-commit.
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "pre-commit-rusty"
|
||||
version = "0.0.5"
|
||||
name = "prefligit"
|
||||
version = "0.0.6"
|
||||
description = "pre-commit reimplemented in Rust"
|
||||
authors = [{ name = "j178", email = "hi@j178.dev" }]
|
||||
requires-python = ">=3.8"
|
||||
@@ -18,9 +18,9 @@ classfiers = [
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/j178/pre-commit-rs"
|
||||
Changelog = "https://github.com/j178/pre-commit-rs/blob/main/CHANGELOG.md"
|
||||
Releases = "https://github.com/j178/pre-commit-rs/releases"
|
||||
Repository = "https://github.com/j178/prefligit"
|
||||
Changelog = "https://github.com/j178/prefligit/blob/main/CHANGELOG.md"
|
||||
Releases = "https://github.com/j178/prefligit/releases"
|
||||
|
||||
[build-system]
|
||||
requires = ["maturin>=1.0,<2.0"]
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "1.82"
|
||||
channel = "1.83"
|
||||
|
||||
@@ -29,7 +29,7 @@ pub(crate) async fn hook_impl(
|
||||
"- To temporarily silence this, run `PRE_COMMIT_ALLOW_NO_CONFIG=1 git ...`"
|
||||
);
|
||||
eprintln!("- To permanently silence this, install hooks with the `--allow-missing-config` flag");
|
||||
eprintln!("- To uninstall hooks, run `pre-commit uninstall`");
|
||||
eprintln!("- To uninstall hooks, run `prefligit uninstall`");
|
||||
Ok(ExitStatus::Failure)
|
||||
};
|
||||
}
|
||||
|
||||
+10
-10
@@ -136,13 +136,13 @@ fn install_hook_script(
|
||||
args.push("--skip-on-missing-config".to_string());
|
||||
}
|
||||
|
||||
let pre_commit = std::env::current_exe()?;
|
||||
let pre_commit = pre_commit.simplified().display().to_string();
|
||||
let prefligit = std::env::current_exe()?;
|
||||
let pre_commit = prefligit.simplified().display().to_string();
|
||||
let hook_script = HOOK_TMPL
|
||||
.replace("ARGS=(hook-impl)", &format!("ARGS=({})", args.join(" ")))
|
||||
.replace(
|
||||
r#"PRE_COMMIT="pre-commit""#,
|
||||
&format!(r#"PRE_COMMIT="{pre_commit}""#),
|
||||
r#"PREFLIGIT="prefligit""#,
|
||||
&format!(r#"PREFLIGIT="{pre_commit}""#),
|
||||
);
|
||||
fs_err::OpenOptions::new()
|
||||
.write(true)
|
||||
@@ -162,7 +162,7 @@ fn install_hook_script(
|
||||
|
||||
writeln!(
|
||||
printer.stdout(),
|
||||
"pre-commit installed at {}",
|
||||
"prefligit installed at {}",
|
||||
hook_path.user_display().cyan()
|
||||
)?;
|
||||
|
||||
@@ -171,16 +171,16 @@ fn install_hook_script(
|
||||
|
||||
static HOOK_TMPL: &str = indoc! { r#"
|
||||
#!/usr/bin/env bash
|
||||
# File generated by pre-commit-rs: https://github.com/j178/pre-commit-rs
|
||||
# File generated by prefligit: https://github.com/j178/prefligit
|
||||
# ID: 182c10f181da4464a3eec51b83331688
|
||||
|
||||
ARGS=(hook-impl)
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
ARGS+=(--hook-dir "$HERE" -- "$@")
|
||||
PRE_COMMIT="pre-commit"
|
||||
PREFLIGIT="prefligit"
|
||||
|
||||
exec "$PRE_COMMIT" "${ARGS[@]}"
|
||||
exec "$PREFLIGIT" "${ARGS[@]}"
|
||||
|
||||
"# };
|
||||
|
||||
@@ -190,7 +190,7 @@ static PRIOR_HASHES: &[&str] = &[];
|
||||
// Use a different hash from `pre-commit` since our script is different.
|
||||
static CURRENT_HASH: &str = "182c10f181da4464a3eec51b83331688";
|
||||
|
||||
/// Checks if the script contains any of the hashes that `pre-commit` has used in the past.
|
||||
/// Checks if the script contains any of the hashes that `prefligit` has used in the past.
|
||||
fn is_our_script(hook_path: &Path) -> Result<bool> {
|
||||
let content = fs_err::read_to_string(hook_path)?;
|
||||
Ok(std::iter::once(CURRENT_HASH)
|
||||
@@ -217,7 +217,7 @@ pub(crate) async fn uninstall(
|
||||
} else if !is_our_script(&hook_path)? {
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{} is not managed by pre-commit, skipping.",
|
||||
"{} is not managed by prefligit, skipping.",
|
||||
hook_path.user_display().cyan()
|
||||
)?;
|
||||
} else {
|
||||
|
||||
+7
-7
@@ -76,7 +76,7 @@ impl From<ColorChoice> for anstream::ColorChoice {
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
name = "pre-commit",
|
||||
name = "prefligit",
|
||||
author,
|
||||
version,
|
||||
about = "pre-commit reimplemented in Rust"
|
||||
@@ -135,7 +135,7 @@ pub(crate) struct GlobalArgs {
|
||||
#[arg(global = true, short, long, action = ArgAction::Count)]
|
||||
pub(crate) verbose: u8,
|
||||
|
||||
/// Display the pre-commit version.
|
||||
/// Display the prefligit version.
|
||||
#[arg(global = true, short = 'V', long, action = clap::ArgAction::Version)]
|
||||
version: Option<bool>,
|
||||
|
||||
@@ -148,14 +148,14 @@ pub(crate) struct GlobalArgs {
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub(crate) enum Command {
|
||||
/// Install the git pre-commit hook.
|
||||
/// Install the git prefligit hook.
|
||||
#[command(name = "install")]
|
||||
Install(InstallArgs),
|
||||
/// Create hook environments for all hooks used in the config file.
|
||||
InstallHooks,
|
||||
/// Run hooks.
|
||||
Run(Box<RunArgs>),
|
||||
/// Uninstall the pre-commit script.
|
||||
/// Uninstall the prefligit script.
|
||||
Uninstall(UninstallArgs),
|
||||
/// Validate `.pre-commit-config.yaml` files.
|
||||
ValidateConfig(ValidateConfigArgs),
|
||||
@@ -180,7 +180,7 @@ pub(crate) enum Command {
|
||||
#[command(hide = true)]
|
||||
HookImpl(HookImplArgs),
|
||||
|
||||
/// `pre-commit-rs` self management.
|
||||
/// `prefligit` self management.
|
||||
#[command(name = "self")]
|
||||
Self_(SelfNamespace),
|
||||
|
||||
@@ -317,14 +317,14 @@ pub struct SelfNamespace {
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum SelfCommand {
|
||||
/// Update pre-commit-rs.
|
||||
/// Update prefligit.
|
||||
Update(SelfUpdateArgs),
|
||||
}
|
||||
|
||||
#[derive(Debug, Args)]
|
||||
pub struct SelfUpdateArgs {
|
||||
/// Update to the specified version.
|
||||
/// If not provided, pre-commit-rs will update to the latest version.
|
||||
/// If not provided, prefligit will update to the latest version.
|
||||
pub target_version: Option<String>,
|
||||
|
||||
/// A GitHub token for authentication.
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ pub(crate) async fn run(
|
||||
if should_stash && git::has_unmerged_paths().await? {
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"You have unmerged paths. Resolve them before running pre-commit."
|
||||
"You have unmerged paths. Resolve them before running prefligit."
|
||||
)?;
|
||||
return Ok(ExitStatus::Failure);
|
||||
}
|
||||
|
||||
+14
-14
@@ -31,13 +31,13 @@ use tracing::{debug, enabled};
|
||||
use crate::cli::ExitStatus;
|
||||
use crate::printer::Printer;
|
||||
|
||||
/// Attempt to update the pre-commit-rs binary.
|
||||
/// Attempt to update the prefligit binary.
|
||||
pub(crate) async fn self_update(
|
||||
version: Option<String>,
|
||||
token: Option<String>,
|
||||
printer: Printer,
|
||||
) -> Result<ExitStatus> {
|
||||
let mut updater = AxoUpdater::new_for("pre-commit-rs");
|
||||
let mut updater = AxoUpdater::new_for("prefligit");
|
||||
if enabled!(tracing::Level::DEBUG) {
|
||||
env::set_var("INSTALLER_PRINT_VERBOSE", "1");
|
||||
updater.enable_installer_output();
|
||||
@@ -50,18 +50,18 @@ pub(crate) async fn self_update(
|
||||
}
|
||||
|
||||
// Load the "install receipt" for the current binary. If the receipt is not found, then
|
||||
// pre-commit-rs was likely installed via a package manager.
|
||||
// prefligit was likely installed via a package manager.
|
||||
let Ok(updater) = updater.load_receipt() else {
|
||||
debug!("no receipt found; assuming pre-commit-rs was installed via a package manager");
|
||||
debug!("no receipt found; assuming prefligit was installed via a package manager");
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{}",
|
||||
format_args!(
|
||||
concat!(
|
||||
"{}{} Self-update is only available for pre-commit-rs binaries installed via the standalone installation scripts.",
|
||||
"{}{} Self-update is only available for prefligit binaries installed via the standalone installation scripts.",
|
||||
"\n",
|
||||
"\n",
|
||||
"If you installed pre-commit-rs with pip, brew, or another package manager, update pre-commit-rs with `pip install --upgrade`, `brew upgrade`, or similar."
|
||||
"If you installed prefligit with pip, brew, or another package manager, update prefligit with `pip install --upgrade`, `brew upgrade`, or similar."
|
||||
),
|
||||
"warning".yellow().bold(),
|
||||
":".bold()
|
||||
@@ -71,21 +71,21 @@ pub(crate) async fn self_update(
|
||||
};
|
||||
|
||||
// Ensure the receipt is for the current binary. If it's not, then the user likely has multiple
|
||||
// pre-commit-rs binaries installed, and the current binary was _not_ installed via the standalone
|
||||
// prefligit binaries installed, and the current binary was _not_ installed via the standalone
|
||||
// installation scripts.
|
||||
if !updater.check_receipt_is_for_this_executable()? {
|
||||
debug!(
|
||||
"receipt is not for this executable; assuming pre-commit-rs was installed via a package manager"
|
||||
"receipt is not for this executable; assuming prefligit was installed via a package manager"
|
||||
);
|
||||
writeln!(
|
||||
printer.stderr(),
|
||||
"{}",
|
||||
format_args!(
|
||||
concat!(
|
||||
"{}{} Self-update is only available for pre-commit-rs binaries installed via the standalone installation scripts.",
|
||||
"{}{} Self-update is only available for prefligit binaries installed via the standalone installation scripts.",
|
||||
"\n",
|
||||
"\n",
|
||||
"If you installed pre-commit-rs with pip, brew, or another package manager, update pre-commit-rs with `pip install --upgrade`, `brew upgrade`, or similar."
|
||||
"If you installed prefligit with pip, brew, or another package manager, update prefligit with `pip install --upgrade`, `brew upgrade`, or similar."
|
||||
),
|
||||
"warning".yellow().bold(),
|
||||
":".bold()
|
||||
@@ -113,7 +113,7 @@ pub(crate) async fn self_update(
|
||||
updater.configure_version_specifier(update_request);
|
||||
|
||||
// Run the updater. This involves a network request, since we need to determine the latest
|
||||
// available version of pre-commit-rs.
|
||||
// available version of prefligit.
|
||||
match updater.run().await {
|
||||
Ok(Some(result)) => {
|
||||
let version_information = if let Some(old_version) = result.old_version {
|
||||
@@ -130,12 +130,12 @@ pub(crate) async fn self_update(
|
||||
printer.stderr(),
|
||||
"{}",
|
||||
format_args!(
|
||||
"{}{} Upgraded pre-commit-rs {}! {}",
|
||||
"{}{} Upgraded prefligit {}! {}",
|
||||
"success".green().bold(),
|
||||
":".bold(),
|
||||
version_information,
|
||||
format!(
|
||||
"https://github.com/j178/pre-commit-rs/releases/tag/{}",
|
||||
"https://github.com/j178/prefligit/releases/tag/{}",
|
||||
result.new_version_tag
|
||||
)
|
||||
.cyan()
|
||||
@@ -147,7 +147,7 @@ pub(crate) async fn self_update(
|
||||
printer.stderr(),
|
||||
"{}",
|
||||
format_args!(
|
||||
"{}{} You're on the latest version of pre-commit-rs ({})",
|
||||
"{}{} You're on the latest version of prefligit ({})",
|
||||
"success".green().bold(),
|
||||
":".bold(),
|
||||
format!("v{}", env!("CARGO_PKG_VERSION")).bold().white()
|
||||
|
||||
@@ -22,7 +22,7 @@ pub(crate) async fn ensure_uv() -> Result<PathBuf> {
|
||||
return Ok(uv);
|
||||
}
|
||||
|
||||
// 2) Check if `uv` is installed by `pre-commit-rs`
|
||||
// 2) Check if `uv` is installed by `prefligit`
|
||||
let store = Store::from_settings()?;
|
||||
|
||||
let uv_dir = store.uv_path();
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
|
||||
cli.command = Some(Command::Run(Box::new(cli.run_args.clone())));
|
||||
}
|
||||
|
||||
debug!("pre-commit: {}", env!("CARGO_PKG_VERSION"));
|
||||
debug!("prefligit: {}", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
match get_root().await {
|
||||
Ok(root) => {
|
||||
|
||||
+8
-8
@@ -47,7 +47,7 @@ impl TestContext {
|
||||
.map(|pattern| (pattern, "[HOME]/".to_string())),
|
||||
);
|
||||
|
||||
let current_exe = assert_cmd::cargo::cargo_bin("pre-commit");
|
||||
let current_exe = assert_cmd::cargo::cargo_bin("prefligit");
|
||||
filters.extend(
|
||||
Self::path_patterns(¤t_exe)
|
||||
.into_iter()
|
||||
@@ -63,13 +63,13 @@ impl TestContext {
|
||||
}
|
||||
|
||||
pub fn test_bucket_dir() -> PathBuf {
|
||||
env::var("PRE_COMMIT_INTERNAL__TEST_DIR")
|
||||
env::var("PREFLIGIT_INTERNAL__TEST_DIR")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|_| {
|
||||
etcetera::base_strategy::choose_base_strategy()
|
||||
.expect("Failed to find base strategy")
|
||||
.data_dir()
|
||||
.join("pre-commit-rs")
|
||||
.join("prefligit")
|
||||
.join("tests")
|
||||
})
|
||||
}
|
||||
@@ -112,7 +112,7 @@ impl TestContext {
|
||||
}
|
||||
|
||||
pub fn command(&self) -> Command {
|
||||
let bin = assert_cmd::cargo::cargo_bin("pre-commit");
|
||||
let bin = assert_cmd::cargo::cargo_bin("prefligit");
|
||||
let mut cmd = Command::new(bin);
|
||||
cmd.current_dir(self.workdir());
|
||||
cmd.env("PRE_COMMIT_HOME", &*self.home_dir);
|
||||
@@ -177,7 +177,7 @@ impl TestContext {
|
||||
&self.temp_dir
|
||||
}
|
||||
|
||||
/// Initialize a sample project for pre-commit.
|
||||
/// Initialize a sample project for prefligit.
|
||||
pub fn init_project(&self) {
|
||||
Command::new("git")
|
||||
.arg("init")
|
||||
@@ -192,14 +192,14 @@ impl TestContext {
|
||||
Command::new("git")
|
||||
.arg("config")
|
||||
.arg("user.name")
|
||||
.arg("Pre-Commit Test")
|
||||
.arg("Prefligit Test")
|
||||
.current_dir(&self.temp_dir)
|
||||
.assert()
|
||||
.success();
|
||||
Command::new("git")
|
||||
.arg("config")
|
||||
.arg("user.email")
|
||||
.arg("test@pre-commit-rs.dev")
|
||||
.arg("test@prefligit.dev")
|
||||
.current_dir(&self.temp_dir)
|
||||
.assert()
|
||||
.success();
|
||||
@@ -241,7 +241,7 @@ pub const INSTA_FILTERS: &[(&str, &str)] = &[
|
||||
(r"(\s|\()(\d+\.)?\d+([KM]i)?B", "$1[SIZE]"),
|
||||
// Rewrite Windows output to Unix output
|
||||
(r"\\([\w\d]|\.\.)", "/$1"),
|
||||
(r"pre-commit.exe", "pre-commit"),
|
||||
(r"prefligit.exe", "prefligit"),
|
||||
// The exact message is host language dependent
|
||||
(
|
||||
r"Caused by: .* \(os error 2\)",
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ fn hook_impl() {
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
pre-commit installed at .git/hooks/pre-commit
|
||||
prefligit installed at .git/hooks/pre-commit
|
||||
|
||||
----- stderr -----
|
||||
"#);
|
||||
|
||||
+23
-28
@@ -13,12 +13,12 @@ fn install() -> anyhow::Result<()> {
|
||||
let context = TestContext::new();
|
||||
context.init_project();
|
||||
|
||||
// Install `pre-commit` hook.
|
||||
// Install `prefligit` hook.
|
||||
cmd_snapshot!(context.filters(), context.install(), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
pre-commit installed at .git/hooks/pre-commit
|
||||
prefligit installed at .git/hooks/pre-commit
|
||||
|
||||
----- stderr -----
|
||||
"#);
|
||||
@@ -28,17 +28,16 @@ fn install() -> anyhow::Result<()> {
|
||||
{
|
||||
assert_snapshot!(context.read(".git/hooks/pre-commit"), @r##"
|
||||
#!/usr/bin/env bash
|
||||
# File generated by pre-commit-rs: https://github.com/j178/pre-commit-rs
|
||||
# File generated by prefligit: https://github.com/j178/prefligit
|
||||
# ID: 182c10f181da4464a3eec51b83331688
|
||||
|
||||
ARGS=(hook-impl --hook-type=pre-commit)
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
ARGS+=(--hook-dir "$HERE" -- "$@")
|
||||
PRE_COMMIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PRE_COMMIT" "${ARGS[@]}"
|
||||
PREFLIGIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PREFLIGIT" "${ARGS[@]}"
|
||||
"##);
|
||||
}
|
||||
);
|
||||
@@ -54,8 +53,8 @@ fn install() -> anyhow::Result<()> {
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
Hook already exists at .git/hooks/pre-commit, move it to .git/hooks/pre-commit.legacy.
|
||||
pre-commit installed at .git/hooks/pre-commit
|
||||
pre-commit installed at .git/hooks/post-commit
|
||||
prefligit installed at .git/hooks/pre-commit
|
||||
prefligit installed at .git/hooks/post-commit
|
||||
|
||||
----- stderr -----
|
||||
"#);
|
||||
@@ -64,17 +63,16 @@ fn install() -> anyhow::Result<()> {
|
||||
{
|
||||
assert_snapshot!(context.read(".git/hooks/pre-commit"), @r##"
|
||||
#!/usr/bin/env bash
|
||||
# File generated by pre-commit-rs: https://github.com/j178/pre-commit-rs
|
||||
# File generated by prefligit: https://github.com/j178/prefligit
|
||||
# ID: 182c10f181da4464a3eec51b83331688
|
||||
|
||||
ARGS=(hook-impl --hook-type=pre-commit)
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
ARGS+=(--hook-dir "$HERE" -- "$@")
|
||||
PRE_COMMIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PRE_COMMIT" "${ARGS[@]}"
|
||||
PREFLIGIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PREFLIGIT" "${ARGS[@]}"
|
||||
"##);
|
||||
}
|
||||
);
|
||||
@@ -89,17 +87,16 @@ fn install() -> anyhow::Result<()> {
|
||||
{
|
||||
assert_snapshot!(context.read(".git/hooks/post-commit"), @r##"
|
||||
#!/usr/bin/env bash
|
||||
# File generated by pre-commit-rs: https://github.com/j178/pre-commit-rs
|
||||
# File generated by prefligit: https://github.com/j178/prefligit
|
||||
# ID: 182c10f181da4464a3eec51b83331688
|
||||
|
||||
ARGS=(hook-impl --hook-type=post-commit)
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
ARGS+=(--hook-dir "$HERE" -- "$@")
|
||||
PRE_COMMIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PRE_COMMIT" "${ARGS[@]}"
|
||||
PREFLIGIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PREFLIGIT" "${ARGS[@]}"
|
||||
"##);
|
||||
}
|
||||
);
|
||||
@@ -110,9 +107,9 @@ fn install() -> anyhow::Result<()> {
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
Overwriting existing hook at .git/hooks/pre-commit
|
||||
pre-commit installed at .git/hooks/pre-commit
|
||||
prefligit installed at .git/hooks/pre-commit
|
||||
Overwriting existing hook at .git/hooks/post-commit
|
||||
pre-commit installed at .git/hooks/post-commit
|
||||
prefligit installed at .git/hooks/post-commit
|
||||
|
||||
----- stderr -----
|
||||
"#);
|
||||
@@ -122,17 +119,16 @@ fn install() -> anyhow::Result<()> {
|
||||
{
|
||||
assert_snapshot!(context.read(".git/hooks/pre-commit"), @r##"
|
||||
#!/usr/bin/env bash
|
||||
# File generated by pre-commit-rs: https://github.com/j178/pre-commit-rs
|
||||
# File generated by prefligit: https://github.com/j178/prefligit
|
||||
# ID: 182c10f181da4464a3eec51b83331688
|
||||
|
||||
ARGS=(hook-impl --hook-type=pre-commit)
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
ARGS+=(--hook-dir "$HERE" -- "$@")
|
||||
PRE_COMMIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PRE_COMMIT" "${ARGS[@]}"
|
||||
PREFLIGIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PREFLIGIT" "${ARGS[@]}"
|
||||
"##);
|
||||
}
|
||||
);
|
||||
@@ -141,17 +137,16 @@ fn install() -> anyhow::Result<()> {
|
||||
{
|
||||
assert_snapshot!(context.read(".git/hooks/post-commit"), @r##"
|
||||
#!/usr/bin/env bash
|
||||
# File generated by pre-commit-rs: https://github.com/j178/pre-commit-rs
|
||||
# File generated by prefligit: https://github.com/j178/prefligit
|
||||
# ID: 182c10f181da4464a3eec51b83331688
|
||||
|
||||
ARGS=(hook-impl --hook-type=post-commit)
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
ARGS+=(--hook-dir "$HERE" -- "$@")
|
||||
PRE_COMMIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PRE_COMMIT" "${ARGS[@]}"
|
||||
PREFLIGIT="[CURRENT_EXE]"
|
||||
|
||||
exec "$PREFLIGIT" "${ARGS[@]}"
|
||||
"##);
|
||||
}
|
||||
);
|
||||
@@ -201,7 +196,7 @@ fn uninstall() -> anyhow::Result<()> {
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
.git/hooks/pre-commit is not managed by pre-commit, skipping.
|
||||
.git/hooks/pre-commit is not managed by prefligit, skipping.
|
||||
"#);
|
||||
|
||||
// Restore previous hook.
|
||||
@@ -248,7 +243,7 @@ fn init_template_dir() {
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
pre-commit installed at .git/hooks/pre-commit
|
||||
prefligit installed at .git/hooks/pre-commit
|
||||
|
||||
----- stderr -----
|
||||
`init.templateDir` not set to the target directory
|
||||
|
||||
+1
-1
@@ -778,7 +778,7 @@ fn merge_conflicts() -> Result<()> {
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
You have unmerged paths. Resolve them before running pre-commit.
|
||||
You have unmerged paths. Resolve them before running prefligit.
|
||||
"#);
|
||||
|
||||
// Fix the conflict and run again.
|
||||
|
||||
Reference in New Issue
Block a user