summaryrefslogtreecommitdiff
path: root/add-patch.c
diff options
context:
space:
mode:
Diffstat (limited to 'add-patch.c')
-rw-r--r--add-patch.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/add-patch.c b/add-patch.c
index 9402dc71bc..173a53241e 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1416,7 +1416,8 @@ N_("j - go to the next undecided hunk, roll over at the bottom\n"
"/ - search for a hunk matching the given regex\n"
"s - split the current hunk into smaller hunks\n"
"e - manually edit the current hunk\n"
- "p - print the current hunk, 'P' to use the pager\n"
+ "p - print the current hunk\n"
+ "P - print the current hunk using the pager\n"
"? - print help\n");
static size_t dec_mod(size_t a, size_t m)
@@ -1547,7 +1548,7 @@ static int patch_update_file(struct add_p_state *s,
permitted |= ALLOW_EDIT;
strbuf_addstr(&s->buf, ",e");
}
- strbuf_addstr(&s->buf, ",p");
+ strbuf_addstr(&s->buf, ",p,P");
}
if (file_diff->deleted)
prompt_mode_type = PROMPT_DELETION;
@@ -1568,8 +1569,10 @@ static int patch_update_file(struct add_p_state *s,
if (*s->s.reset_color_interactive)
fputs(s->s.reset_color_interactive, stdout);
fflush(stdout);
- if (read_single_character(s) == EOF)
+ if (read_single_character(s) == EOF) {
+ quit = 1;
break;
+ }
if (!s->answer.len)
continue;
@@ -1600,7 +1603,7 @@ soft_increment:
} else if (hunk->use == UNDECIDED_HUNK) {
hunk->use = USE_HUNK;
}
- } else if (ch == 'd' || ch == 'q') {
+ } else if (ch == 'd') {
if (file_diff->hunk_nr) {
for (; hunk_index < file_diff->hunk_nr; hunk_index++) {
hunk = file_diff->hunk + hunk_index;
@@ -1612,10 +1615,9 @@ soft_increment:
} else if (hunk->use == UNDECIDED_HUNK) {
hunk->use = SKIP_HUNK;
}
- if (ch == 'q') {
- quit = 1;
- break;
- }
+ } else if (ch == 'q') {
+ quit = 1;
+ break;
} else if (s->answer.buf[0] == 'K') {
if (permitted & ALLOW_GOTO_PREVIOUS_HUNK)
hunk_index = dec_mod(hunk_index,