125
return error(_("--3way outside a repository"));
126
state->check_index = 1;
127
}
128
- if (state->apply_with_reject)
129
- state->apply = state->apply_verbosely = 1;
128
+ if (state->apply_with_reject) {
129
+ state->apply = 1;
130
+ if (state->apply_verbosity == verbosity_normal)
131
+ state->apply_verbosity = verbosity_verbose;
132
+ }
133
if (!force_apply && (state->diffstat || state->numstat || state->summary || state->check || state->fake_ancestor))
134
state->apply = 0;
135
if (state->check_index && is_not_gitdir)
1623
return;
1624
1625
err = whitespace_error_string(result);
1623
- fprintf(stderr, "%s:%d: %s.\n%.*s\n",
1624
- state->patch_input_file, linenr, err, len, line);
1626
+ if (state->apply_verbosity > verbosity_silent)
1627
+ fprintf(stderr, "%s:%d: %s.\n%.*s\n",
1628
+ state->patch_input_file, linenr, err, len, line);
1629
free(err);
1630
}
1631
1820
return error(_("new file %s depends on old contents"), patch->new_name);
1821
if (0 < patch->is_delete && newlines)
1822
return error(_("deleted file %s still has contents"), patch->old_name);
1819
- if (!patch->is_delete && !newlines && context)
1823
+ if (!patch->is_delete && !newlines && context && state->apply_verbosity > verbosity_silent)
1824
fprintf_ln(stderr,
1825
_("** warning: "
1826
"file %s becomes empty but is not deleted"),
2915
/* Ignore it, we already handled it */
2916
break;
2917
default:
2914
- if (state->apply_verbosely)
2918
+ if (state->apply_verbosity > verbosity_normal)
2919
error(_("invalid start of line: '%c'"), first);
2920
applied_pos = -1;
2921
goto out;
3030
state->apply = 0;
3031
}
3032
3029
- if (state->apply_verbosely && applied_pos != pos) {
3033
+ if (state->apply_verbosity > verbosity_normal && applied_pos != pos) {
3034
int offset = applied_pos - pos;
3035
if (state->apply_in_reverse)
3036
offset = 0 - offset;
3045
* Warn if it was necessary to reduce the number
3046
* of context lines.
3047
*/
3044
- if ((leading != frag->leading) ||
3045
- (trailing != frag->trailing))
3048
+ if ((leading != frag->leading ||
3049
+ trailing != frag->trailing) && state->apply_verbosity > verbosity_silent)
3050
fprintf_ln(stderr, _("Context reduced to (%ld/%ld)"
3051
" to apply fragment at %d"),
3052
leading, trailing, applied_pos+1);
3053
update_image(state, img, applied_pos, &preimage, &postimage);
3054
} else {
3051
- if (state->apply_verbosely)
3055
+ if (state->apply_verbosity > verbosity_normal)
3056
error(_("while searching for:\n%.*s"),
3057
(int)(old - oldlines), oldlines);
3058
}
3543
read_blob_object(&buf, pre_sha1, patch->old_mode))
3544
return error("repository lacks the necessary blob to fall back on 3-way merge.");
3545
3542
- fprintf(stderr, "Falling back to three-way merge...\n");
3546
+ if (state->apply_verbosity > verbosity_silent)
3547
+ fprintf(stderr, "Falling back to three-way merge...\n");
3548
3549
img = strbuf_detach(&buf, &len);
3550
prepare_image(&tmp_image, img, len, 1);
3574
status = three_way_merge(image, patch->new_name,
3575
pre_sha1, our_sha1, post_sha1);
3576
if (status < 0) {
3572
- fprintf(stderr, "Failed to fall back on three-way merge...\n");
3577
+ if (state->apply_verbosity > verbosity_silent)
3578
+ fprintf(stderr,
3579
+ "Failed to fall back on three-way merge...\n");
3580
return status;
3581
}
3582
3588
hashcpy(patch->threeway_stage[0].hash, pre_sha1);
3589
hashcpy(patch->threeway_stage[1].hash, our_sha1);
3590
hashcpy(patch->threeway_stage[2].hash, post_sha1);
3584
- fprintf(stderr, "Applied patch to '%s' with conflicts.\n", patch->new_name);
3591
+ if (state->apply_verbosity > verbosity_silent)
3592
+ fprintf(stderr,
3593
+ "Applied patch to '%s' with conflicts.\n",
3594
+ patch->new_name);
3595
} else {
3586
- fprintf(stderr, "Applied patch to '%s' cleanly.\n", patch->new_name);
3596
+ if (state->apply_verbosity > verbosity_silent)
3597
+ fprintf(stderr,
3598
+ "Applied patch to '%s' cleanly.\n",
3599
+ patch->new_name);
3600
}
3601
return 0;
3602
}
3969
prepare_fn_table(state, patch);
3970
while (patch) {
3971
int res;
3959
- if (state->apply_verbosely)
3972
+ if (state->apply_verbosity > verbosity_normal)
3973
say_patch_name(stderr,
3974
_("Checking patch %s..."), patch);
3975
res = check_patch(state, patch);
4485
}
4486
4487
if (!cnt) {
4475
- if (state->apply_verbosely)
4488
+ if (state->apply_verbosity > verbosity_normal)
4489
say_patch_name(stderr,
4490
_("Applied patch %s cleanly."), patch);
4491
return 0;
4502
"Applying patch %%s with %d rejects...",
4503
cnt),
4504
cnt);
4492
- say_patch_name(stderr, sb.buf, patch);
4505
+ if (state->apply_verbosity > verbosity_silent)
4506
+ say_patch_name(stderr, sb.buf, patch);
4507
strbuf_release(&sb);
4508
4509
cnt = strlen(patch->new_name);
4530
frag;
4531
cnt++, frag = frag->next) {
4532
if (!frag->rejected) {
4519
- fprintf_ln(stderr, _("Hunk #%d applied cleanly."), cnt);
4533
+ if (state->apply_verbosity > verbosity_silent)
4534
+ fprintf_ln(stderr, _("Hunk #%d applied cleanly."), cnt);
4535
continue;
4536
}
4522
- fprintf_ln(stderr, _("Rejected hunk #%d."), cnt);
4537
+ if (state->apply_verbosity > verbosity_silent)
4538
+ fprintf_ln(stderr, _("Rejected hunk #%d."), cnt);
4539
fprintf(rej, "%.*s", frag->size, frag->patch);
4540
if (frag->patch[frag->size-1] != '\n')
4541
fputc('\n', rej);
4584
struct string_list_item *item;
4585
4586
string_list_sort(&cpath);
4571
- for_each_string_list_item(item, &cpath)
4572
- fprintf(stderr, "U %s\n", item->string);
4587
+ if (state->apply_verbosity > verbosity_silent) {
4588
+ for_each_string_list_item(item, &cpath)
4589
+ fprintf(stderr, "U %s\n", item->string);
4590
+ }
4591
string_list_clear(&cpath, 0);
4592
4593
rerere(0);
4644
listp = &patch->next;
4645
}
4646
else {
4629
- if (state->apply_verbosely)
4647
+ if (state->apply_verbosity > verbosity_normal)
4648
say_patch_name(stderr, _("Skipped patch '%s'."), patch);
4649
free_patch(patch);
4650
skipped_patch++;