{"action":"created","issue":{"url":"https://api.github.com/repos/wine-compholio/wine-staging/issues/7","labels_url":"https://api.github.com/repos/wine-compholio/wine-staging/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/wine-compholio/wine-staging/issues/7/comments","events_url":"https://api.github.com/repos/wine-compholio/wine-staging/issues/7/events","html_url":"https://github.com/wine-compholio/wine-staging/issues/7","id":38220357,"number":7,"title":"\"git apply\" fails silently under specific conditions","user":{"login":"slackner","id":5781160,"avatar_url":"https://avatars.githubusercontent.com/u/5781160?v=3","gravatar_id":"","url":"https://api.github.com/users/slackner","html_url":"https://github.com/slackner","followers_url":"https://api.github.com/users/slackner/followers","following_url":"https://api.github.com/users/slackner/following{/other_user}","gists_url":"https://api.github.com/users/slackner/gists{/gist_id}","starred_url":"https://api.github.com/users/slackner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackner/subscriptions","organizations_url":"https://api.github.com/users/slackner/orgs","repos_url":"https://api.github.com/users/slackner/repos","events_url":"https://api.github.com/users/slackner/events{/privacy}","received_events_url":"https://api.github.com/users/slackner/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wine-compholio/wine-staging/labels/upstream-bug","name":"upstream-bug","color":"f7c6c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-07-18T23:38:02Z","updated_at":"2015-01-15T06:13:03Z","closed_at":"2015-01-15T06:13:03Z","body":"Under specific conditions \"git apply\" fails, but doesn't return a nonzero exit-code. This bug was reported some time ago on on the #pipelight channel by package maintainers.\r\n\r\nAlthough this is not a bug in wine-compholio, but instead in \"git\", we should check if we can somehow workaround this issue. Upstreaming a proper bugfix could be done as a second task, but we cannot assume that all distros immediately update a to a newer version, so we still need a workaround.\r\n\r\nCode which can be used to reproduce this issue (run from an empty directory):\r\nhttp://ix.io/cBq\r\n\r\nTo summarize the specific test cases (patch always contains the path {a,b}/test.txt):\r\n\r\n* there is no git root dir at all -> *always works*\r\n* the file exists in the git root dir, which is also the current directory -> *works*\r\n* current directory is a subdirectory of the git root dir, file doesn't exist -> *failure (expected)*\r\n* current directory is a subdirectory of the git root dir, file exists -> *exitcode 0, no error message, but doesn't apply*"},"comment":{"url":"https://api.github.com/repos/wine-compholio/wine-staging/issues/comments/70044178","html_url":"https://github.com/wine-compholio/wine-staging/issues/7#issuecomment-70044178","issue_url":"https://api.github.com/repos/wine-compholio/wine-staging/issues/7","id":70044178,"user":{"login":"slackner","id":5781160,"avatar_url":"https://avatars.githubusercontent.com/u/5781160?v=3","gravatar_id":"","url":"https://api.github.com/users/slackner","html_url":"https://github.com/slackner","followers_url":"https://api.github.com/users/slackner/followers","following_url":"https://api.github.com/users/slackner/following{/other_user}","gists_url":"https://api.github.com/users/slackner/gists{/gist_id}","starred_url":"https://api.github.com/users/slackner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackner/subscriptions","organizations_url":"https://api.github.com/users/slackner/orgs","repos_url":"https://api.github.com/users/slackner/repos","events_url":"https://api.github.com/users/slackner/events{/privacy}","received_events_url":"https://api.github.com/users/slackner/received_events","type":"User","site_admin":false},"created_at":"2015-01-15T06:13:03Z","updated_at":"2015-01-15T06:13:03Z","body":"A workaround was added in 603ba80d413e0d27c8d1c22ac8dd71245756fbd0. Even though I would still consider this an upstream bug (because the exitcode is wrong) I will close this bugreport, because our users do not longer need to pay attention.\r\n\r\nFor those who want to reproduce this issue (and don't want to understand the script above), try out the following steps:\r\n\r\n* Initialize a new git directory in `dir1/dir2`\r\n* Create some files and commit an initial version\r\n* Create a patch with some arbitrary changes\r\n* Delete `dir1/dir2/.git`, and initialize a git directory in `dir1`\r\n* Change directory to `dir1/dir2` and try to apply the patch with `git apply`\r\n\r\nThe exitcode will be zero, but no patch was applied."}}