• Kyle Meyer's avatar
    magit-reverse-files: Extend binary file check · 6cf97f5c
    Kyle Meyer authored
    The magit apply variants fail on binary files because they operate on
    diff output that exists in the buffer, and that output isn't (and
    shouldn't be) inserted with `git diff --binary'.  d0e04a14
    (magit-reverse-files: do not attempt to reverse binary files,
    2015-03-06) provided a more informative error message by checking for
    staged binary files.  Teach magit-reverse-files to also check for
    binary files when reversing files from revision and diff buffers.
    For revision mode, note that we use `diff REV^..REV' rather than
    `diff-index REV', but diff-index would be needed to match what the
    revision buffer shows for merge and root commits.  However, using
    diff-index isn't worth the added complexity.  In the case of a merge
    commit, `diff REV^..REV' would still return the correct list of binary
    files in the very rare case that a binary file shows up as a resolved
    path in a revision buffer.  In the case of a root commit, we'd fail to
    detect binary files, but this just means that we fall back to
    displaying a less informative error message in the process buffer.
    Closes #3625.
magit-apply.el 29.1 KB