Skip to content

Commit

Permalink
Change how scripts navigate to the project's root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
cm-jones committed Jun 29, 2024
1 parent fd2d2b0 commit ce2cb94
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

# Navigate to the project root directory
cd "$(dirname "$0")/.."
cd "$(git rev-parse --show-toplevel)"

# Create and navigate to the build directory
mkdir -p build
Expand Down
2 changes: 1 addition & 1 deletion scripts/format.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Navigate to the project root directory
cd "$(dirname "$0")/.."
cd "$(git rev-parse --show-toplevel)"

# Find changed files (staged in git)
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.cpp$|\.h$')
Expand Down
2 changes: 1 addition & 1 deletion scripts/install_hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

# Navigate to the project root directory
cd "$(dirname "$0")/.."
cd "$(git rev-parse --show-toplevel)"

# Create the pre-commit hook in the .git/hooks directory
HOOKS_DIR=".git/hooks"
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Navigate to the project root directory
cd "$(dirname "$0")/.."
cd "$(git rev-parse --show-toplevel)"

# Directory where the compilation database is located
BUILD_DIR=build
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

# Navigate to the project root directory
cd "$(dirname "$0")/.."
cd "$(git rev-parse --show-toplevel)"

# Navigate to the build directory
cd build
Expand Down
3 changes: 1 addition & 2 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
export PATH="/opt/homebrew/opt/llvm/bin:/usr/local/bin:/usr/bin:/bin:$PATH"

# Navigate to the project root directory
PROJECT_ROOT=$(git rev-parse --show-toplevel)
cd "$PROJECT_ROOT"
cd "$(git rev-parse --show-toplevel)"

# Run clang-format and clang-tidy in parallel
./scripts/format.sh &
Expand Down

0 comments on commit ce2cb94

Please sign in to comment.