{"thread":{"id":"5213","subject":"git patch format with copy/rename + modify, and binary files","startedAt":"2006-08-11T20:50:23Z","lastAt":"2006-08-11T20:50:23Z","messageCount":1,"participants":["Brendan Cully"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"25141","messageId":"20060811205022.GA13521@xanadu.kublai.com","threadId":"5213","inReplyTo":null,"subject":"git patch format with copy/rename + modify, and binary files","fromName":"Brendan Cully","fromEmail":"brendan@kublai.com","sentAt":"2006-08-11T20:50:23Z","receivedAt":"2006-08-11T20:50:23Z","isPatch":false,"sender":{"key":"brendan@kublai.com","avatar":null},"body":"Hi,\n\nWhile working on an external git patch importer, I noticed that git\npatches can break silently when fed to vanilla patch. Take this hunk\nfrom the git tree:\n\ndiff --git a/git-pull-script b/git-fetch-script   \nsimilarity index 89%\ncopy from git-pull-script\ncopy to git-fetch-script\nindex bd892c7..17f22af 100755\n--- a/git-pull-script\n+++ b/git-fetch-script\n@@ -39,8 +39,3 @@ download_one \"$merge_repo/$merge_name\" \"\n\n echo \"Getting object database\"\n download_objects \"$merge_repo\" \"$(cat \"$GIT_DIR\"/MERGE_HEAD)\"\n-\n-git-resolve-script \\\n-       \"$(cat \"$GIT_DIR\"/HEAD)\" \\\n-       \"$(cat \"$GIT_DIR\"/MERGE_HEAD)\" \\\n-       \"$merge_repo\"\n\ngit-apply would presumably create git-fetch-script by copying\ngit-pull-script then deleting this hunk. Vanilla patch simply deletes\nthe hunk from git-pull-script. This seems bad. Is there any reason why\ngit diff shouldn't use\n\n--- a/git-fetch-script\n+++ b/git-fetch-script\n\ninstead?\n\nOn a related note, it'd be nice if the format allowed for some kind of\nrepresentation of binary data. I had a half-baked idea that it could\nhold a line describing the encoding of the diff, eg\n\nencoding base64\n\nwhich could indicate that the diff should be decoded as base64 before\nbeing applied. This could allow a patch to hold a binary file add, or\nwrap a binary diff, though it doesn't specify what form such a diff\nshould take...\n\nthoughts?\n"}]}