{"thread":{"id":"54455","subject":"Issue with staging, unstaging, discarding hunks with no context","startedAt":"2020-10-18T05:48:55Z","lastAt":"2020-10-18T09:13:01Z","messageCount":2,"participants":["Daniel Dinnyes","Phillip Wood"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"407836","messageId":"CAFfHKJ54smgBZrYTEmgoqmo7gMp+H8AxjL3GxnWVdF9K_MnoFg@mail.gmail.com","threadId":"54455","inReplyTo":"CAFfHKJ7kAJ7030GPywKHEWG0vJjC0hhEGt4MMR=85nSHnu5Q-w@mail.gmail.com","subject":"Issue with staging, unstaging, discarding hunks with no context","fromName":"Daniel Dinnyes","fromEmail":"dinnyesd@gmail.com","sentAt":"2020-10-18T05:48:17Z","receivedAt":"2020-10-18T05:48:55Z","isPatch":false,"sender":{"key":"dinnyesd@gmail.com","avatar":null},"body":"The problem I have is described in more detail in the issue here with magit:\nhttps://github.com/magit/magit/issues/4222\n\nThe conclusion there was that this is an upstream problem due to some\nrecent changes in git.\n\nAs it has been mentioned in the issue itself, it is understood that\ngit had problems with handling hunks without context, so I assume this\nupstream change was to eliminate such issues.\n\nYet my experience was that hunks without context worked fine before\n80% of the time, except if they were right next to each other, they\nmight get mixed/messed up. Even in that case, I found that if I\nstaged/unstaged hunks in top-down order in magit it didn't cause\nproblems.\n\nWithout handling no-context hunks, I see I will have to stash/redo\nentire change-sets, to be able to commit logically separate hunks\nseparately. This would be a major PITA.\n\nIs there a plan to reintroduce handling of hunks with 0 line context\nin the future, or is this something which is technically not going to\nbe possible ever?\n\nCheers,\nDan\n"},{"id":"407840","messageId":"26316a94-ed0f-cf52-74f5-b20508345569@gmail.com","threadId":"54455","inReplyTo":"CAFfHKJ54smgBZrYTEmgoqmo7gMp+H8AxjL3GxnWVdF9K_MnoFg@mail.gmail.com","subject":"Re: Issue with staging, unstaging, discarding hunks with no context","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2020-10-18T09:12:52Z","receivedAt":"2020-10-18T09:13:01Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Daniel\n\nOn 18/10/2020 06:48, Daniel Dinnyes wrote:\n> The problem I have is described in more detail in the issue here with magit:\n> https://github.com/magit/magit/issues/4222\n> \n> The conclusion there was that this is an upstream problem due to some\n> recent changes in git.\n\nThat's not my reading of that issue. Specifically this comment by kyleam\n\n     You're blaming the wrong git :) I introduced this change with\n     6b3c90d (magit-apply-patch: Abort when there is no context,\n     2019-08-02). It was prompted by gh-3924, which also brought\n     about d508f02 (apply: Adjust hunk line positions for partial\n     application, 2019-07-28).\n\nSeems to point to this being a change in magit not git.\n\n`git apply --unidiff-zero` will apply zero context patches but as a \nsafety measure they will be rejected without `--unidiff-zero`\n\nBest Wishes\n\nPhillip\n\n> As it has been mentioned in the issue itself, it is understood that\n> git had problems with handling hunks without context, so I assume this\n> upstream change was to eliminate such issues.\n> \n> Yet my experience was that hunks without context worked fine before\n> 80% of the time, except if they were right next to each other, they\n> might get mixed/messed up. Even in that case, I found that if I\n> staged/unstaged hunks in top-down order in magit it didn't cause\n> problems.\n> \n> Without handling no-context hunks, I see I will have to stash/redo\n> entire change-sets, to be able to commit logically separate hunks\n> separately. This would be a major PITA.\n> \n> Is there a plan to reintroduce handling of hunks with 0 line context\n> in the future, or is this something which is technically not going to\n> be possible ever?\n> \n> Cheers,\n> Dan\n> \n"}]}