Draft
Conversation
The diff algorithm is currently selected via bit flags embedded in thexpparam_t flags field (XDF_PATIENCE_DIFF, XDF_HISTOGRAM_DIFF, etc.).This requires bit manipulation and masking to change algorithms, andmakes Myers the implicit default (no bits set) rather than explicit. Introduce a dedicated xdl_algo_t enum type as the first step towards cleaner algorithm selection. This follows a suggestion from Junio [1] to eventually replace the bit flag approach entirely. [1] https://lore.kernel.org/git/xmqqh5v5hmat.fsf@gitster.g/ Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Hoda Salim <hoda.s.salim@gmail.com>
Now that xdl_algo_t exists, update the diff algorithm selection code to use the new enum field instead of bit manipulation. Replace the pattern: `xpp->flags = (xpp->flags & ~XDF_DIFF_ALGORITHM_MASK) | algorithm;` With direct assignment: `xpp->algo = algorithm;` This affects set_diff_algorithm(), blame_diff_algorithm_callback(),blame_diff_algorithm_minimal(), and fall_back_to_classic_diff(). Signed-off-by: Hoda Salim <hoda.s.salim@gmail.com>
Now that all algorithm selection uses the xdl_algo_t enum, remove thelegacy bit flag infrastructure: - XDF_NEED_MINIMAL (as algorithm selector; keep if used elsewhere) - XDF_PATIENCE_DIFF - XDF_HISTOGRAM_DIFF - XDF_DIFF_ALGORITHM_MASK - XDF_DIFF_ALG() macro This completes the refactoring suggested in [1], making algorithm selection explicit via enum assignment rather than implicit via bit manipulation. [1]https://lore.kernel.org/git/xmqqh5v5hmat.fsf@gitster.g/ Signed-off-by: Hoda Salim <hoda.s.salim@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for taking the time to contribute to Git! Please be advised that the
Git community does not use github.com for their contributions. Instead, we use
a mailing list (git@vger.kernel.org) for code submissions, code reviews, and
bug reports. Nevertheless, you can use GitGitGadget (https://gitgitgadget.github.io/)
to conveniently send your Pull Requests commits to our mailing list.
For a single-commit pull request, please leave the pull request description
empty: your commit message itself should describe your changes.
Please read the "guidelines for contributing" linked above!