{"thread":{"id":"51933","subject":"[git issue] git am failed for patches of converting the format of source codes from dos to unix","startedAt":"2019-09-27T07:31:47Z","lastAt":"2019-09-27T09:25:48Z","messageCount":2,"participants":["Beyondhorizon Zheng","Thomas Gummerer"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"383055","messageId":"CAP2YDYhfA__VYe-Kt3FwjPMzJ1jVo8X9eQ-pHR4MhQWypkrkKQ@mail.gmail.com","threadId":"51933","inReplyTo":null,"subject":"[git issue] git am failed for patches of converting the format of source codes from dos to unix","fromName":"Beyondhorizon Zheng","fromEmail":"byndhorizon@gmail.com","sentAt":"2019-09-27T07:31:31Z","receivedAt":"2019-09-27T07:31:47Z","isPatch":false,"sender":{"key":"byndhorizon@gmail.com","avatar":null},"body":"[git issue] git am failed for patches of converting the file format of\nsource codes from dos to unix\n\nGit version: git version 2.23.0\nHost PC: ubuntu 16.04.10\nReporter: Shuang Zheng\n\nI have submitted a patch which convert the file format of source file\nfrom dos to unix with command:\ndos2unix misc/acrn-config/config_app/controller.py\nthen submit a patch with this change:\n        git add controller.py\n        git commit -m “change file format”\n        git format-patch HEAD~1\n        git am 0001-change-file-format.patch\nerrors as below:\nApplying: change file format\nerror: patch failed: misc/acrn-config/config_app/controller.py:1\nerror: misc/acrn-config/config_app/controller.py: patch does not apply\nPatch failed at 0001 fix format\nhint: Use 'git am --show-current-patch' to see the failed patch\nWhen you have resolved this problem, run \"git am --continue\".\nIf you prefer to skip this patch, run \"git am --skip\" instead.\nTo restore the original branch and stop patching, run \"git am --abort\".\n"},{"id":"383056","messageId":"20190927092543.GE11444@cat","threadId":"51933","inReplyTo":"CAP2YDYhfA__VYe-Kt3FwjPMzJ1jVo8X9eQ-pHR4MhQWypkrkKQ@mail.gmail.com","subject":"Re: [git issue] git am failed for patches of converting the format of source codes from dos to unix","fromName":"Thomas Gummerer","fromEmail":"t.gummerer@gmail.com","sentAt":"2019-09-27T09:25:43Z","receivedAt":"2019-09-27T09:25:48Z","isPatch":false,"sender":{"key":"t.gummerer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/191004?v=4"},"body":"On 09/27, Beyondhorizon Zheng wrote:\n> [git issue] git am failed for patches of converting the file format of\n> source codes from dos to unix\n> \n> Git version: git version 2.23.0\n> Host PC: ubuntu 16.04.10\n> Reporter: Shuang Zheng\n> \n> I have submitted a patch which convert the file format of source file\n> from dos to unix with command:\n> dos2unix misc/acrn-config/config_app/controller.py\n> then submit a patch with this change:\n>         git add controller.py\n>         git commit -m “change file format”\n>         git format-patch HEAD~1\n\nHere you are preparing a patch of your last commit.  Good.\n\n>         git am 0001-change-file-format.patch\n\nRunning this right after 'git format-patch' will try to apply the\npatch, but your latest commit already includes those changes.  So\nthere is nothing to apply, and 'git am' fails.  Normally you would not\nuse 'format-patch' and then try to apply the patch again, but rather\nsend it to someone else, who could then apply your changes.\n\nYou could use 'git am -3 0001-change-file-format.patch', which falls\nback to a three-way merge, which should tell you something like:\n\n    No changes -- Patch already applied.\n\nIf you want to check that the patch applies correctly, you can use\n'git reset --hard HEAD~1' (make sure you don't have any untracked\nchanges you don't want to loose first), and then use the 'git am'\ncommand from above.\n\nHope that helps.\n\n> errors as below:\n> Applying: change file format\n> error: patch failed: misc/acrn-config/config_app/controller.py:1\n> error: misc/acrn-config/config_app/controller.py: patch does not apply\n> Patch failed at 0001 fix format\n> hint: Use 'git am --show-current-patch' to see the failed patch\n> When you have resolved this problem, run \"git am --continue\".\n> If you prefer to skip this patch, run \"git am --skip\" instead.\n> To restore the original branch and stop patching, run \"git am --abort\".\n"}]}