Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: --remerge-diff needs to keep around commit parents #1825

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Nov 11, 2024

  1. log: --remerge-diff needs to keep around commit parents

    To show a remerge diff, the merge needs to be recreated. For that to
    work, the merge base(s) need to be found, which means that the commits'
    parents have to be traversed until common ancestors are found (if any).
    
    However, one optimization that hails all the way back to
    cb11574 (Some more memory leak avoidance, 2006-06-17) is to release
    the commit's list of parents immediately after showing it. This can break
    the merge base computation.
    
    Note that it matters more clearly when traversing the commits in
    reverse: In that instance, if a parent of a merge commit has been shown
    as part of the `git log` command, by the time the merge commit's diff
    needs to be computed, that parent commit's list of parent commits will
    have been set to `NULL` and as a result no merge base will be found.
    
    Let's fix this by special-casing the `remerge_diff` mode, similar to
    what we did with reflogs in f35650d (log: do not free parents when
    walking reflog, 2017-07-07).
    
    Signed-off-by: Johannes Schindelin <[email protected]>
    dscho committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    afff27f View commit details
    Browse the repository at this point in the history