@@ -2437,7 +2437,8 @@ static void update_image(struct image *img,
2437
2437
}
2438
2438
2439
2439
static int apply_one_fragment (struct image * img , struct fragment * frag ,
2440
- int inaccurate_eof , unsigned ws_rule )
2440
+ int inaccurate_eof , unsigned ws_rule ,
2441
+ int nth_fragment )
2441
2442
{
2442
2443
int match_beginning , match_end ;
2443
2444
const char * patch = frag -> patch ;
@@ -2643,6 +2644,15 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
2643
2644
apply = 0 ;
2644
2645
}
2645
2646
2647
+ if (apply_verbosely && applied_pos != pos ) {
2648
+ int offset = applied_pos - pos ;
2649
+ if (apply_in_reverse )
2650
+ offset = 0 - offset ;
2651
+ fprintf (stderr ,
2652
+ "Hunk #%d succeeded at %d (offset %d lines).\n" ,
2653
+ nth_fragment , applied_pos + 1 , offset );
2654
+ }
2655
+
2646
2656
/*
2647
2657
* Warn if it was necessary to reduce the number
2648
2658
* of context lines.
@@ -2790,12 +2800,14 @@ static int apply_fragments(struct image *img, struct patch *patch)
2790
2800
const char * name = patch -> old_name ? patch -> old_name : patch -> new_name ;
2791
2801
unsigned ws_rule = patch -> ws_rule ;
2792
2802
unsigned inaccurate_eof = patch -> inaccurate_eof ;
2803
+ int nth = 0 ;
2793
2804
2794
2805
if (patch -> is_binary )
2795
2806
return apply_binary (img , patch );
2796
2807
2797
2808
while (frag ) {
2798
- if (apply_one_fragment (img , frag , inaccurate_eof , ws_rule )) {
2809
+ nth ++ ;
2810
+ if (apply_one_fragment (img , frag , inaccurate_eof , ws_rule , nth )) {
2799
2811
error ("patch failed: %s:%ld" , name , frag -> oldpos );
2800
2812
if (!apply_with_reject )
2801
2813
return -1 ;
0 commit comments