• Johan Herland's avatar
    diff.c: Ensure "index $from..$to" line contains unambiguous SHA1s · 3e5a188f
    Johan Herland authored
    In the metainfo section of git diffs there's an "index" line providing
    abbreviated (unless --full-index is used) blob SHA1s from the
    pre-/post-images used to generate the diff. These provide hints that
    can be used to reconstruct a 3-way merge when applying the patch
    (see the --3way option to 'git am' for more details).
    In order for this to work, however, the blob SHA1s must not be
    abbreviated into ambiguity.
    This patch eliminates the possible ambiguity by using find_unique_abbrev()
    to produce the abbreviated SHA1s (instead of blind abbreviation by way of
    A testcase verifying the fix is also included.
    Signed-off-by: default avatarJohan Herland <[email protected]>
    Signed-off-by: default avatarJunio C Hamano <[email protected]>
t4044-diff-index-unique-abbrev.sh 767 Bytes