Skip to content

improve interactive-patch

Rubén Justo git 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 2 repliesIn review
  2. v32 patches 3 repliesSuperseded
  3. v22 patches 21 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches4 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2add-patch: introduce 'p' in interactive-patchDocumentation/git-add.txt add-patch.c t/t3701-add-interactive.sh+16 -110 replies
2/2add-patch: do not print hunks repeatedlyadd-patch.c+14 -72 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/2] improve interactive-patch

Let's reduce the verbosity in the interactive-patch process, in order to make it less confusing.

Rubén Justo (2):
add-patch: introduce 'p' in interactive-patch
add-patch: do not print hunks repeatedly

 Documentation/git-add.txt  |  1 +
 add-patch.c                | 23 +++++++++++++++++------
 t/t3701-add-interactive.sh | 22 +++++++++++-----------
 3 files changed, 29 insertions(+), 17 deletions(-)

Range-diff against v3:
1: 545ca3f0b3 ! 1: 338f1ebc9e add-patch: introduce 'p' in interactive-patch
@@ Documentation/git-add.txt: patch::
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
-+ p - print the current hunk again
++ p - print the current hunk
? - print help
+
After deciding the fate for all hunks, if there is any hunk
@@ add-patch.c: 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 again\n"
++ "p - print the current hunk\n"
"? - print help\n");

static int patch_update_file(struct add_p_state *s,
2: b6b98e5dbb ! 2: e17b8d70f1 add-patch: do not print hunks repeatedly

    @@ add-patch.c: static int patch_update_file(struct add_p_state *s,
      				permitted |= ALLOW_GOTO_PREVIOUS_UNDECIDED_HUNK;
      				strbuf_addstr(&s->buf, ",k");
     @@ add-patch.c: static int patch_update_file(struct add_p_state *s,
    - 			if (!(permitted & ALLOW_SPLIT))
    + 			hunk_index = i;
    + 		} else if (s->answer.buf[0] == 's') {
    + 			size_t splittable_into = hunk->splittable_into;
    +-			if (!(permitted & ALLOW_SPLIT))
    ++			if (!(permitted & ALLOW_SPLIT)) {
      				err(s, _("Sorry, cannot split this hunk"));
    - 			else if (!split_hunk(s, file_diff,
    +-			else if (!split_hunk(s, file_diff,
     -					     hunk - file_diff->hunk))
    ++			} else if (!split_hunk(s, file_diff,
     +					     hunk - file_diff->hunk)) {
      				color_fprintf_ln(stdout, s->s.header_color,
      						 _("Split into %d hunks."),
Signature · 1 line
2.44.0.370.ge17b8d70f1