@@ -42,7 +42,7 @@ When run with no arguments this will:
42
42
" ,
43
43
raw( max_term_width = "100" ) ,
44
44
raw( setting = "structopt::clap::AppSettings::UnifiedHelpMessage" ) ,
45
- raw( setting = "structopt::clap::AppSettings::ColoredHelp" ) ,
45
+ raw( setting = "structopt::clap::AppSettings::ColoredHelp" )
46
46
) ]
47
47
struct Args {
48
48
/// Use `squash!`: change the commit message that you amend
@@ -68,7 +68,7 @@ fn main() {
68
68
// An empty message means don't display any error message
69
69
let msg = e. to_string ( ) ;
70
70
if !msg. is_empty ( ) {
71
- println ! ( "Error running rebase : {}" , e) ;
71
+ println ! ( "Error: {}" , e) ;
72
72
}
73
73
}
74
74
}
@@ -109,9 +109,14 @@ fn create_fixup_commit<'a>(
109
109
) -> Result < Commit < ' a > , Box < Error > > {
110
110
let diffstat = diff. stats ( ) ?;
111
111
if diffstat. files_changed ( ) == 0 {
112
- print_diff ( Changes :: Unstaged ) ?;
113
- if !Confirmation :: new ( "Nothing staged, stage and commit everything?" ) . interact ( ) ? {
114
- return Err ( "" . into ( ) ) ;
112
+ let dirty_workdir_stats = repo. diff_index_to_workdir ( None , None ) ?. stats ( ) ?;
113
+ if dirty_workdir_stats. files_changed ( ) > 0 {
114
+ print_diff ( Changes :: Unstaged ) ?;
115
+ if !Confirmation :: new ( "Nothing staged, stage and commit everything?" ) . interact ( ) ? {
116
+ return Err ( "" . into ( ) ) ;
117
+ }
118
+ } else {
119
+ return Err ( "Nothing staged and no tracked files have any changes" . into ( ) ) ;
115
120
}
116
121
let pathspecs: Vec < & str > = vec ! [ ] ;
117
122
let mut idx = repo. index ( ) ?;
0 commit comments