Skip to content

Commit

Permalink
[clang-format] Fix a serious bug in git-clang-format (#65723)
Browse files Browse the repository at this point in the history
When applying format changes to staged files, git-clang-format
erroneously checks out all files in the index and thus may overwrite
unstaged changes.

Fixes #65643.

(cherry picked from commit 743659b)
  • Loading branch information
owenca authored and tru committed Oct 17, 2023
1 parent 268faa3 commit aeb83c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/tools/clang-format/git-clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def apply_changes(old_tree, new_tree, force=False, patch_mode=False):
index_tree = old_tree
else:
with temporary_index_file(new_tree):
run('git', 'checkout-index', '-a', '-f')
run('git', 'checkout-index', '-f', '--', *changed_files)
return changed_files


Expand Down

0 comments on commit aeb83c3

Please sign in to comment.