Skip to content

Commit

Permalink
Compare branches
Browse files Browse the repository at this point in the history
  • Loading branch information
samjwu committed May 22, 2024
1 parent 24d5926 commit 8db6a55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
- name: Check Clang-Format on Diff
run: |
./clang-format-diff.sh
./clang-format-diff.sh ${{ github.base_ref }} ${{ github.ref }}
5 changes: 4 additions & 1 deletion clang-format-diff.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

BASE_BRANCH=$1
CURRENT_BRANCH=$2

# Save unified diff with 0 context
git diff -U0 HEAD > changes.diff
git diff -U0 --name-only $BASE_BRANCH...$CURRENT_BRANCH > changes.diff

# Apply clang-format on diff
FORMAT_DIFF=$(clang-format -style=file changes.diff)
Expand Down

0 comments on commit 8db6a55

Please sign in to comment.