Message ID | 0691d7eaaa03e8bf8b460b9e20ec05eec09fb574.1661867664.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | cfd0163d641e785f20d29b70edf83c777941594f |
Headers | show |
Series | A couple of CI fixes regarding the built-in add --patch | expand |
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes: > From: Johannes Schindelin <johannes.schindelin@gmx.de> > > In the interactive `add` operation, users can choose to jump to specific > hunks, and Git will present the hunk list in that case. To avoid showing > too many lines at once, only a maximum of 21 hunks are shown, skipping > the "mode change" pseudo hunk. Wow. While the whole "add -i" was what I started, I admit that everything more recent than the support of the "edit" action in "add -p" is foreign to me. I didn't remember the existence of, and the justification for, the 20-line limit. It seems that this came from 3f6aff68 (Add subroutine to display one-line summary of hunks, 2008-12-04). > The comparison performed to skip the "mode change" pseudo hunk (if any) > compares a signed integer `i` to the unsigned value `mode_change` (which > can be 0 or 1 because it is a 1-bit type). OK, that warrants a casting to signed, surely. > Note: This is a long-standing bug in the Visual C build of Git, but it > has never been caught because t3701 is skipped when `NO_PERL` is set, > which is the case in the `vs-test` jobs of Git's CI runs. Good finding. > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> > --- > add-patch.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/add-patch.c b/add-patch.c > index 509ca04456b..3524555e2b0 100644 > --- a/add-patch.c > +++ b/add-patch.c > @@ -1547,7 +1547,7 @@ soft_increment: > strbuf_remove(&s->answer, 0, 1); > strbuf_trim(&s->answer); > i = hunk_index - DISPLAY_HUNKS_LINES / 2; > - if (i < file_diff->mode_change) > + if (i < (int)file_diff->mode_change) > i = file_diff->mode_change; > while (s->answer.len == 0) { > i = display_hunks(s, file_diff, i);
diff --git a/add-patch.c b/add-patch.c index 509ca04456b..3524555e2b0 100644 --- a/add-patch.c +++ b/add-patch.c @@ -1547,7 +1547,7 @@ soft_increment: strbuf_remove(&s->answer, 0, 1); strbuf_trim(&s->answer); i = hunk_index - DISPLAY_HUNKS_LINES / 2; - if (i < file_diff->mode_change) + if (i < (int)file_diff->mode_change) i = file_diff->mode_change; while (s->answer.len == 0) { i = display_hunks(s, file_diff, i);