Skip to content

Commit aeb83c3

Browse files
owencatru
authored andcommitted
[clang-format] Fix a serious bug in git-clang-format (#65723)
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)
1 parent 268faa3 commit aeb83c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/tools/clang-format/git-clang-format

+1-1
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def apply_changes(old_tree, new_tree, force=False, patch_mode=False):
605605
index_tree = old_tree
606606
else:
607607
with temporary_index_file(new_tree):
608-
run('git', 'checkout-index', '-a', '-f')
608+
run('git', 'checkout-index', '-f', '--', *changed_files)
609609
return changed_files
610610

611611

0 commit comments

Comments
 (0)