Skip to content

Conversation

@sina-hide
Copy link
Contributor

Motivation: Some editors (depending on editor configuration) change the last line of a file by adding a missing newline. But in order to keep diffs at a minimum, it's sometimes advisable to not include this change into the commit. This should be possible by discarding the hunk with this change.

Now it is possible to discard (or stage/unstage) such a change. Previously discarding such a change was ignored, when there were other changes in the same file.

Motivation: Some editors (depending on editor configuration) change the
last line of a file by adding a missing newline.  But in order to keep
diffs at a minimum, it's sometimes advisable to not include this change
into the commit.  This should be possible by discarding the hunk with
this change.

Now it is possible to discard (or stage/unstage) such a change.
Previously discarding such a change was ignored, when there were other
changes in the same file.
@love-linger love-linger self-assigned this Nov 10, 2025
@love-linger love-linger added the bug Something isn't working label Nov 10, 2025
@love-linger love-linger merged commit f88c424 into sourcegit-scm:develop Nov 10, 2025
14 checks passed
love-linger added a commit that referenced this pull request Nov 10, 2025
For untracked/added file, `\\ No newline at end of file` will always be added to the end of patch.

Signed-off-by: leo <longshuang@msn.cn>
@sina-hide sina-hide deleted the hunk-without-newline branch November 10, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants