From 54992c08aecb2fc91aecacccc15d3a17ae7390dc Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 14 Sep 2024 12:25:02 +0200 Subject: rc git: teach "git apply" to work on content, not just diffs Staging/unstaging/reverting (parts of) the current buffer's file can be a common use case. Today "git apply" can do that based on a selection within a diff. When the selection is on uncommitted content, we can probably assume that the intent is to use the part of the selection that overlaps with the +-side of "git diff" (or "git diff --cached" for "git apply --cached"). Make "git apply" treat selections as content if the buffile is tracked by Git. This differentiator is not perfect but I don't know why anyone would want to use the existing "git apply" semantics on a tracked file. Maybe we should pick a different name. This feature couples well with "git show-diff", which shows all lines with unstaged changes (in future it should probably show staged changes as well). Whereas on diffs, "git apply" stages the entire hunk if the selection contains no newline, this does not happen when operating on content. I didn't yet try implementing that. I guess the hunks are not as explicit here. Closes #5225 --- src/main.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/main.cc b/src/main.cc index 09c9b718..5eb30bc6 100644 --- a/src/main.cc +++ b/src/main.cc @@ -48,6 +48,7 @@ struct { 0, "» kak_* appearing in shell arguments will be added to the environment\n" "» {+U}double underline{} support\n" + "» {+u}git apply{} can stage/revert selected changes to current buffer\n" }, { 20240518, "» Fix tests failing on some platforms\n" -- cgit v1.2.3