diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2025-03-24 01:30:22 +0100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2025-03-25 08:11:27 +1100 |
| commit | 807e04654cb52e128d40f9f05365104d9e7f51d6 (patch) | |
| tree | d7219fc8fafd406410c1bdf3f4f3d3b55c21dd1b /rc | |
| parent | 1c50bcd8943e104081090ee1cbaf6e367d75ca4e (diff) | |
rc git: fix blame/blame-jump/apply on files with eolformat=crlf
<a-|> produces \n line endings, which confuses Git when the tracked file
uses \r\n line endings. Work around that.
Diffstat (limited to 'rc')
| -rw-r--r-- | rc/tools/git.kak | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/rc/tools/git.kak b/rc/tools/git.kak index 0d334625..607c34ef 100644 --- a/rc/tools/git.kak +++ b/rc/tools/git.kak @@ -201,10 +201,7 @@ define-command -params 1.. \ rev=$1 # empty means index shift buffile_relative=${kak_buffile#"$(git rev-parse --show-toplevel)/"} - echo >${kak_command_fifo} "evaluate-commands -save-regs | %{ - set-register | %{ cat >${kak_response_fifo} } - execute-keys -draft %{%<a-|><ret>} - }" + echo >${kak_command_fifo} "evaluate-commands -no-hooks write ${kak_response_fifo}" git show "$rev:${buffile_relative}" | diff - ${kak_response_fifo} "$@" | awk -v buffile_relative="$buffile_relative" ' @@ -304,13 +301,10 @@ define-command -params 1.. \ fi set -- "$@" --contents - -- "${kak_buffile}" # use stdin to work around git bug blame_stdin=$(mktemp "${TMPDIR:-/tmp}"/kak-git.XXXXXX) - echo >${kak_command_fifo} "evaluate-commands -save-regs | %{ - set-register | %{ - cat >${blame_stdin} - : >${kak_response_fifo} - } - execute-keys -client ${kak_client} -draft %{%<a-|><ret>} - }" + echo >${kak_command_fifo} " + evaluate-commands -no-hooks write -force ${blame_stdin} + echo -to-file ${kak_response_fifo} + " : <${kak_response_fifo} } fi echo 'map window normal <ret> %{:git blame-jump<ret>}' @@ -626,10 +620,7 @@ define-command -params 1.. \ } else { set -- --contents - -- "${kak_buffile}" # use stdin to work around git bug blame_stdin=${kak_response_fifo} - echo >${kak_command_fifo} "evaluate-commands -save-regs | %{ - set-register | %{ cat >${kak_response_fifo} } - execute-keys -client ${kak_client} -draft %{%<a-|><ret>} - }" + echo >${kak_command_fifo} "evaluate-commands -no-hooks write ${kak_response_fifo}" } fi if ! blame_info=$( git blame --porcelain -L"$cursor_line,$cursor_line" "$@" <${blame_stdin}) |
