The only user-visible change is rewriting of the --help message to make the different modes more clear.
Internally, this is a significant refactoring to make the source and destination of the diff to be more clear by using subclasses rather than conditionals. The purpose is to support the next patch in this series, which adds support for a --staged flag. But even if that does not go through, the intent is for this code to be a readability improvement.
Note: In run_clang_format_and_save_to_tree(), we now generate the entire index up front rather than feeding it in line-by-line via a generator. The reason we must do this is because, in the future --staged implementation, we need to read from the index *before* calling crate_tree() since create_tree() uses a temporary index file. In practice, this will have no performance impact because the previous commit (D41130) switched to loading it all into memory in create_tree() anyway.