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)
Sat, Mar 15, 10:09 PM
Unknown Object (File)
Wed, Mar 12, 8:44 AM
Unknown Object (File)
Tue, Mar 11, 3:44 PM
Unknown Object (File)
Tue, Mar 11, 2:52 PM
Unknown Object (File)
Thu, Mar 6, 6:01 AM
Unknown Object (File)
Thu, Mar 6, 2:05 AM
Unknown Object (File)
Thu, Mar 6, 2:05 AM
Unknown Object (File)
Thu, Mar 6, 2:04 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
Lint Not Applicable
Unit
Tests Not Applicable