summaryrefslogtreecommitdiffstats
path: root/add-patch.c
diff options
context:
space:
mode:
authorRubén Justo <rjusto@gmail.com>2024-03-29 04:58:28 +0100
committerJunio C Hamano <gitster@pobox.com>2024-03-29 06:40:08 +0100
commit66c14ab592f0226168a7411184c2e3ffc05e30b8 (patch)
tree9a54959a4a1e28282999967e6647b66fc524048a /add-patch.c
parentThe eleventh batch (diff)
downloadgit-66c14ab592f0226168a7411184c2e3ffc05e30b8.tar.xz
git-66c14ab592f0226168a7411184c2e3ffc05e30b8.zip
add-patch: introduce 'p' in interactive-patch
Shortly we're going make interactive-patch stop printing automatically the hunk under certain circumstances. Let's introduce a new option to allow the user to explicitly request the printing. Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'add-patch.c')
-rw-r--r--add-patch.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/add-patch.c b/add-patch.c
index 68f525b35c..b5d3a3f0cc 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1388,6 +1388,7 @@ N_("j - leave this hunk undecided, see next undecided hunk\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\n"
"? - print help\n");
static int patch_update_file(struct add_p_state *s,
@@ -1480,6 +1481,7 @@ static int patch_update_file(struct add_p_state *s,
permitted |= ALLOW_EDIT;
strbuf_addstr(&s->buf, ",e");
}
+ strbuf_addstr(&s->buf, ",p");
}
if (file_diff->deleted)
prompt_mode_type = PROMPT_DELETION;
@@ -1658,6 +1660,8 @@ soft_increment:
hunk->use = USE_HUNK;
goto soft_increment;
}
+ } else if (s->answer.buf[0] == 'p') {
+ /* nothing special is needed */
} else {
const char *p = _(help_patch_remainder), *eol = p;