Skip to content

Commit 62af694

Browse files
committed
[git-clang-format-all] Apply fixup commits one at a time.
I discovered while using this locally that it is possible to get a series of rebased commits that cause the rebase to failure. The problem goes away when one applies the changes one at a time rather than all at once. This is also just a more robust way to do this since we are not relying on git-clang-format's hunk logic and git's rebase hunk logic to be in sync.
1 parent 96900f9 commit 62af694

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

utils/git-clang-format-all.zsh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ for commit in "${COMMITS[@]}"; do
6565
echo "Processing commit: $commit ($(git log --oneline -1 $commit))"
6666

6767
if ! git-clang-format "${commit}^" >/dev/null ; then
68-
echo " Committed fixup commit with formatting changes"
68+
echo " Formatting required"
6969
git commit --quiet -a --fixup "${commit}"
70+
git -c sequence.editor=: rebase -i --autosquash --quiet "${commit}^"
7071
else
7172
echo " No formatting changes needed"
7273
fi
7374
done
7475

75-
echo "Squashing fixup commits using git rebase autosquash"
76-
git -c sequence.editor=: rebase -i --autosquash --quiet "${TARGET_HASH}^"
77-
7876
echo "All commits formatted successfully"

0 commit comments

Comments
 (0)