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)
Wed, Apr 9, 12:17 AM
Unknown Object (File)
Wed, Apr 9, 12:17 AM
Unknown Object (File)
Wed, Apr 9, 12:17 AM
Unknown Object (File)
Wed, Apr 9, 12:17 AM
Unknown Object (File)
Mon, Apr 7, 11:57 AM
Unknown Object (File)
Fri, Apr 4, 6:16 PM
Unknown Object (File)
Tue, Apr 1, 10:41 AM
Unknown Object (File)
Tue, Apr 1, 10:41 AM
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
No Lint Coverage
Unit
No Test Coverage