git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Issue with staging, unstaging, discarding hunks with no context

From
DDDaniel Dinnyes <dinnyesd@gmail.com>
Date
Oct 18, 2020, 05:48 UTC
Message-ID
<CAFfHKJ54smgBZrYTEmgoqmo7gMp+H8AxjL3GxnWVdF9K_MnoFg@mail.gmail.com>
In-Reply-To
<CAFfHKJ7kAJ7030GPywKHEWG0vJjC0hhEGt4MMR=85nSHnu5Q-w@mail.gmail.com>

The problem I have is described in more detail in the issue here with magit: https://github.com/magit/magit/issues/4222

The conclusion there was that this is an upstream problem due to some recent changes in git.

As it has been mentioned in the issue itself, it is understood that git had problems with handling hunks without context, so I assume this upstream change was to eliminate such issues.

Yet my experience was that hunks without context worked fine before 80% of the time, except if they were right next to each other, they might get mixed/messed up. Even in that case, I found that if I staged/unstaged hunks in top-down order in magit it didn't cause problems.

Without handling no-context hunks, I see I will have to stash/redo entire change-sets, to be able to commit logically separate hunks separately. This would be a major PITA.

Is there a plan to reintroduce handling of hunks with 0 line context in the future, or is this something which is technically not going to be possible ever?

Cheers, Dan

Next: Phillip Wood
Message 1 of 2 in “Issue with staging, unstaging, discarding hunks with no context”
  1. Daniel DinnyesOct 18, 2020
  2. Phillip WoodOct 18, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.