Skip to content
Snippets Groups Projects
Commit 4bdd6e7c authored by Phillip Wood's avatar Phillip Wood Committed by Junio C Hamano
Browse files

add -p: improve error messages


If the user presses a key that isn't currently active then explain why
it isn't active rather than just listing all the keys. It already did
this for some keys, this patch does the same for the those that
weren't already handled.

Signed-off-by: default avatarPhillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
parent 88f6ffc1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1437,8 +1437,12 @@ sub patch_update_file {
}
next;
}
elsif ($other =~ /g/ && $line =~ /^g(.*)/) {
elsif ($line =~ /^g(.*)/) {
my $response = $1;
unless ($other =~ /g/) {
error_msg __("No other hunks to goto\n");
next;
}
my $no = $ix > 10 ? $ix - 10 : 0;
while ($response eq '') {
$no = display_hunks(\@hunk, $no);
Loading
Loading
@@ -1556,7 +1560,11 @@ sub patch_update_file {
next;
}
}
elsif ($other =~ /s/ && $line =~ /^s/) {
elsif ($line =~ /^s/) {
unless ($other =~ /s/) {
error_msg __("Sorry, cannot split this hunk\n");
next;
}
my @split = split_hunk($hunk[$ix]{TEXT}, $hunk[$ix]{DISPLAY});
if (1 < @split) {
print colored $header_color, sprintf(
Loading
Loading
@@ -1568,7 +1576,11 @@ sub patch_update_file {
$num = scalar @hunk;
next;
}
elsif ($other =~ /e/ && $line =~ /^e/) {
elsif ($line =~ /^e/) {
unless ($other =~ /e/) {
error_msg __("Sorry, cannot edit this hunk\n");
next;
}
my $newhunk = edit_hunk_loop($head, \@hunk, $ix);
if (defined $newhunk) {
splice @hunk, $ix, 1, $newhunk;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment