@@ -129,6 +129,7 @@ fn run_with_repo(logger: &slog::Logger, config: &Config, repo: &git2::Repository
129
129
130
130
let mut hunks_with_commit = vec ! [ ] ;
131
131
132
+ let mut modified_hunks_without_target = 0usize ;
132
133
let mut patches_considered = 0usize ;
133
134
' patch: for index_patch in index. iter ( ) {
134
135
let old_path = index_patch. new_path . as_slice ( ) ;
@@ -266,11 +267,7 @@ fn run_with_repo(logger: &slog::Logger, config: &Config, repo: &git2::Repository
266
267
// the hunk commutes with every commit in the stack,
267
268
// so there is no commit to absorb it into
268
269
None => {
269
- warn ! (
270
- logger,
271
- "Could not find a commit to fix up, use \
272
- --base to increase the search range."
273
- ) ;
270
+ modified_hunks_without_target += 1 ;
274
271
continue ' hunk;
275
272
}
276
273
} ;
@@ -380,6 +377,15 @@ fn run_with_repo(logger: &slog::Logger, config: &Config, repo: &git2::Repository
380
377
--base to increase the search range."
381
378
)
382
379
}
380
+
381
+ if modified_hunks_without_target > 0 {
382
+ warn ! (
383
+ logger,
384
+ "Could not find a commit to fix up, use \
385
+ --base to increase the search range."
386
+ ) ;
387
+ }
388
+
383
389
if stack. is_empty ( ) {
384
390
crit ! ( logger, "No commits available to fix up, exiting" ) ;
385
391
return Ok ( ( ) ) ;
@@ -627,11 +633,6 @@ mod tests {
627
633
"msg" : "Could not find a commit to fix up, \
628
634
use --base to increase the search range.",
629
635
} ) ,
630
- & json!( {
631
- "level" : "WARN" ,
632
- "msg" : "Could not find a commit to fix up, \
633
- use --base to increase the search range.",
634
- } ) ,
635
636
] ,
636
637
) ;
637
638
}
@@ -725,11 +726,6 @@ mod tests {
725
726
"msg" : "Could not find a commit to fix up, \
726
727
use --base to increase the search range.",
727
728
} ) ,
728
- & json!( {
729
- "level" : "WARN" ,
730
- "msg" : "Could not find a commit to fix up, \
731
- use --base to increase the search range.",
732
- } ) ,
733
729
] ,
734
730
) ;
735
731
}
@@ -793,11 +789,6 @@ mod tests {
793
789
"msg" : "Could not find a commit to fix up, \
794
790
use --base to increase the search range.",
795
791
} ) ,
796
- & json!( {
797
- "level" : "WARN" ,
798
- "msg" : "Could not find a commit to fix up, \
799
- use --base to increase the search range.",
800
- } ) ,
801
792
& json!( {
802
793
"level" : "CRIT" ,
803
794
"msg" : "No commits available to fix up, exiting" ,
@@ -838,11 +829,6 @@ mod tests {
838
829
"msg" : "Could not find a commit to fix up, \
839
830
use --base to increase the search range.",
840
831
} ) ,
841
- & json!( {
842
- "level" : "WARN" ,
843
- "msg" : "Could not find a commit to fix up, \
844
- use --base to increase the search range.",
845
- } ) ,
846
832
& json!( {
847
833
"level" : "CRIT" ,
848
834
"msg" : "No commits available to fix up, exiting" ,
@@ -924,18 +910,11 @@ mod tests {
924
910
925
911
log_utils:: assert_log_messages_are (
926
912
capturing_logger. visible_logs ( ) ,
927
- vec ! [
928
- & json!( {
929
- "level" : "WARN" ,
930
- "msg" : "Could not find a commit to fix up, \
931
- use --base to increase the search range.",
932
- } ) ,
933
- & json!( {
934
- "level" : "WARN" ,
935
- "msg" : "Could not find a commit to fix up, \
936
- use --base to increase the search range.",
937
- } ) ,
938
- ] ,
913
+ vec ! [ & json!( {
914
+ "level" : "WARN" ,
915
+ "msg" : "Could not find a commit to fix up, \
916
+ use --base to increase the search range.",
917
+ } ) ] ,
939
918
) ;
940
919
}
941
920
@@ -963,18 +942,11 @@ mod tests {
963
942
964
943
log_utils:: assert_log_messages_are (
965
944
capturing_logger. visible_logs ( ) ,
966
- vec ! [
967
- & json!( {
968
- "level" : "WARN" ,
969
- "msg" : "Could not find a commit to fix up, \
970
- use --base to increase the search range.",
971
- } ) ,
972
- & json!( {
973
- "level" : "WARN" ,
974
- "msg" : "Could not find a commit to fix up, \
975
- use --base to increase the search range.",
976
- } ) ,
977
- ] ,
945
+ vec ! [ & json!( {
946
+ "level" : "WARN" ,
947
+ "msg" : "Could not find a commit to fix up, \
948
+ use --base to increase the search range.",
949
+ } ) ] ,
978
950
) ;
979
951
}
980
952
@@ -1001,18 +973,11 @@ mod tests {
1001
973
1002
974
log_utils:: assert_log_messages_are (
1003
975
capturing_logger. visible_logs ( ) ,
1004
- vec ! [
1005
- & json!( {
1006
- "level" : "WARN" ,
1007
- "msg" : "Could not find a commit to fix up, \
1008
- use --base to increase the search range.",
1009
- } ) ,
1010
- & json!( {
1011
- "level" : "WARN" ,
1012
- "msg" : "Could not find a commit to fix up, \
1013
- use --base to increase the search range.",
1014
- } ) ,
1015
- ] ,
976
+ vec ! [ & json!( {
977
+ "level" : "WARN" ,
978
+ "msg" : "Could not find a commit to fix up, \
979
+ use --base to increase the search range.",
980
+ } ) ] ,
1016
981
) ;
1017
982
}
1018
983
@@ -1069,11 +1034,6 @@ mod tests {
1069
1034
"msg" : "Could not find a commit to fix up, \
1070
1035
use --base to increase the search range.",
1071
1036
} ) ,
1072
- & json!( {
1073
- "level" : "WARN" ,
1074
- "msg" : "Could not find a commit to fix up, \
1075
- use --base to increase the search range.",
1076
- } ) ,
1077
1037
& json!( { "level" : "CRIT" , "msg" : "No commits available to fix up, exiting" } ) ,
1078
1038
] ,
1079
1039
) ;
@@ -1190,11 +1150,6 @@ mod tests {
1190
1150
"msg" : "Could not find a commit to fix up, \
1191
1151
use --base to increase the search range.",
1192
1152
} ) ,
1193
- & json!( {
1194
- "level" : "WARN" ,
1195
- "msg" : "Could not find a commit to fix up, \
1196
- use --base to increase the search range.",
1197
- } ) ,
1198
1153
& json!( { "level" : "CRIT" , "msg" : "No commits available to fix up, exiting" } ) ,
1199
1154
] ,
1200
1155
) ;
0 commit comments