Skip to content

Commit 34742d0

Browse files
ThomsonTancijothomaslalitb
authored
Set pwd for precommit.sh script to support running it in any directory (#2535)
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com> Co-authored-by: Lalit Kumar Bhasin <lalit_fin@yahoo.com>
1 parent eeb367d commit 34742d0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CONTRIBUTING.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ Open a pull request against the main
7979
repo.
8080

8181
> **Note**
82-
> It is recommended to run [pre-commit script](scripts/precommit.sh) from the root of
83-
the repo to catch any issues locally.
82+
> It is recommended to run [pre-commit script](scripts/precommit.sh) to catch any issues locally.
8483
8584
### How to Receive Comments
8685

scripts/precommit.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
cargo update && cargo fmt --all && ./scripts/lint.sh && ./scripts/test.sh
1+
REPO_ROOT=$(dirname $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ))
2+
3+
pushd "${REPO_ROOT}" > /dev/null
4+
5+
cargo update && cargo fmt --all && ./scripts/lint.sh && ./scripts/test.sh
6+
7+
popd > /dev/null

0 commit comments

Comments
 (0)