Page MenuHomePhabricator

[Chore] Unbreak rust_pre_commit for UNIX
ClosedPublic

Authored by jon on Sep 9 2022, 12:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Feb 4, 9:24 AM
Unknown Object (File)
Mon, Feb 3, 1:40 PM
Unknown Object (File)
Fri, Jan 31, 12:39 AM
Unknown Object (File)
Mon, Jan 27, 8:19 PM
Unknown Object (File)
Mon, Jan 27, 7:56 PM
Unknown Object (File)
Wed, Jan 22, 11:13 AM
Unknown Object (File)
Jan 8 2025, 4:19 AM
Unknown Object (File)
Jan 7 2025, 10:11 PM
Subscribers

Details

Summary

Setting PATH to a directory also unsets how to find commands.
So cargo fmt would just return command not found: cargo.

This uses a different variable other than PATH to reference the directories.

Likely this was overlooked, because it doesn't look like anyone has touched the
rust files since this hook was introduced.

Also: not everyone has a $HOME/.cargo/env, and command -v <command> is the canonical POSIX way to check if a command exists on PATH

Test Plan
# change something under services/commtest
git add services/commtest
git commit --dry-run # should succeed

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable