Skip to content
  • Jeff King's avatar
    merge-recursive: don't detect renames of empty files · 4f7cb99a
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Merge-recursive detects renames so that if one side modifies
    "foo" and the other side moves it to "bar", the modification
    is applied to "bar". However, our rename detection is based
    on content analysis, it can be wrong (i.e., two files were
    not intended as a rename, but just happen to have the same
    or similar content).
    
    This is quite rare if the files actually contain content,
    since two unrelated files are unlikely to have exactly the
    same content.  However, empty files present a problem, in
    that there is nothing to analyze. An uninteresting
    placeholder file with zero bytes may or may not be related
    to a placeholder file with another name.
    
    The result is that adding content to an empty file may cause
    confusion if the other side of a merge removed it; your
    content may end up in another random placeholder file that
    was added.
    
    Let's err on the side of caution and not consider empty
    files as renames. This will cause a modify/delete conflict
    on the merge, which will let the user sort it out
    themselves.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    4f7cb99a