Mercurial > public > mercurial-scm > hg-stable
diff tests/test-import-git.t @ 16524:ed6a74312176 stable
patch: be more tolerant with EOLs in binary diffs (issue2870)
The only place where an trailing CR could be meaningful is in the "diff --git"
line as part of a filename, and existing code already rule out this
possibility. Extend the CR/LF filtering to the whole binary hunk.
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Thu, 26 Apr 2012 21:44:02 +0200 |
parents | 727068417b95 |
children | bb91c602d4ad |
line wrap: on
line diff
--- a/tests/test-import-git.t Thu Apr 26 21:44:00 2012 +0200 +++ b/tests/test-import-git.t Thu Apr 26 21:44:02 2012 +0200 @@ -412,6 +412,27 @@ abort: could not extract "binary2" binary data [255] +Simulate a copy/paste turning LF into CRLF (issue2870) + + $ hg revert -aq + $ cat > binary.diff <<"EOF" + > diff --git a/text2 b/binary2 + > rename from text2 + > rename to binary2 + > index 78981922613b2afb6025042ff6bd878ac1994e85..10efcb362e9f3b3420fcfbfc0e37f3dc16e29757 + > GIT binary patch + > literal 5 + > Mc$`b*O5$Pw00T?_*Z=?k + > + > EOF + >>> fp = file('binary.diff', 'rb') + >>> data = fp.read() + >>> fp.close() + >>> file('binary.diff', 'wb').write(data.replace('\n', '\r\n')) + $ rm binary2 + $ hg import --no-commit binary.diff + applying binary.diff + $ cd .. Consecutive import with renames (issue2459)