From 62af694fcbf70a7179bbabb516a8c78486dc6a51 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Tue, 2 Sep 2025 09:26:31 -0700 Subject: [PATCH] [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. --- utils/git-clang-format-all.zsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/utils/git-clang-format-all.zsh b/utils/git-clang-format-all.zsh index aee8df9729bd1..7e62321d3e9d9 100755 --- a/utils/git-clang-format-all.zsh +++ b/utils/git-clang-format-all.zsh @@ -65,14 +65,12 @@ for commit in "${COMMITS[@]}"; do echo "Processing commit: $commit ($(git log --oneline -1 $commit))" if ! git-clang-format "${commit}^" >/dev/null ; then - echo " Committed fixup commit with formatting changes" + echo " Formatting required" git commit --quiet -a --fixup "${commit}" + git -c sequence.editor=: rebase -i --autosquash --quiet "${commit}^" else echo " No formatting changes needed" fi done -echo "Squashing fixup commits using git rebase autosquash" -git -c sequence.editor=: rebase -i --autosquash --quiet "${TARGET_HASH}^" - echo "All commits formatted successfully"