rc git: support uncommitted lines in git blame too
I frequently run ":git diff" followed by ":git blame-jump" to find the commit that added the lines I deleted. I wasn't sure whether ":git blame" should allow this use case too. I think it should, I don't think this is too confusing.
This commit is contained in:
parent
efaf9ab4e2
commit
07d58cab9e
|
@ -222,11 +222,23 @@ define-command -params 1.. \
|
||||||
evaluate-commands -client '${kak_client}' -draft %{
|
evaluate-commands -client '${kak_client}' -draft %{
|
||||||
try %{
|
try %{
|
||||||
execute-keys <a-l><semicolon><a-?>^commit<ret><a-semicolon>
|
execute-keys <a-l><semicolon><a-?>^commit<ret><a-semicolon>
|
||||||
|
} catch %{
|
||||||
|
# Missing commit line, assume it is an uncommitted change.
|
||||||
|
execute-keys <a-l><semicolon><a-?>\A<ret><a-semicolon>
|
||||||
|
}
|
||||||
require-module diff
|
require-module diff
|
||||||
try %{
|
try %{
|
||||||
diff-parse END %{
|
diff-parse END %{
|
||||||
my $line = $file_line;
|
my $line = $file_line;
|
||||||
if ($diff_line_text =~ m{^[-]}) {
|
if (not defined $commit) {
|
||||||
|
$commit = "HEAD";
|
||||||
|
$line = $other_file_line;
|
||||||
|
if ($diff_line_text =~ m{^\+}) {
|
||||||
|
print "echo -to-file '${kak_response_fifo}' -quoting shell "
|
||||||
|
. "%{git blame: blame from HEAD does not work on added lines}";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} elsif ($diff_line_text =~ m{^[-]}) {
|
||||||
$commit = "$commit~";
|
$commit = "$commit~";
|
||||||
$line = $other_file_line;
|
$line = $other_file_line;
|
||||||
}
|
}
|
||||||
|
@ -237,11 +249,6 @@ define-command -params 1.. \
|
||||||
} catch %{
|
} catch %{
|
||||||
echo -to-file '${kak_response_fifo}' -quoting shell -- %val{error}
|
echo -to-file '${kak_response_fifo}' -quoting shell -- %val{error}
|
||||||
}
|
}
|
||||||
} catch %{
|
|
||||||
# Missing commit line, assume it is an uncommitted change.
|
|
||||||
echo -to-file '${kak_response_fifo}' -quoting shell -- \
|
|
||||||
"git blame: blaming without commit line is not yet supported"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
n=$#
|
n=$#
|
||||||
|
|
Loading…
Reference in New Issue
Block a user