@@ -143,9 +143,13 @@ pub async fn publish(
143
143
. ok ( )
144
144
. is_none ( )
145
145
&& !publish_flags. allow_dirty
146
- && check_if_git_repo_dirty ( cli_options. initial_cwd ( ) ) . await
147
146
{
148
- bail ! ( "Aborting due to uncommitted changes. Check in source code or run with --allow-dirty" ) ;
147
+ if let Some ( dirty_text) =
148
+ check_if_git_repo_dirty ( cli_options. initial_cwd ( ) ) . await
149
+ {
150
+ log:: error!( "\n Uncommitted changes:\n \n {}\n " , dirty_text) ;
151
+ bail ! ( "Aborting due to uncommitted changes. Check in source code or run with --allow-dirty" ) ;
152
+ }
149
153
}
150
154
151
155
if publish_flags. dry_run {
@@ -306,7 +310,10 @@ impl PublishPreparer {
306
310
} else if std:: env:: var ( "DENO_INTERNAL_FAST_CHECK_OVERWRITE" ) . as_deref ( )
307
311
== Ok ( "1" )
308
312
{
309
- if check_if_git_repo_dirty ( self . cli_options . initial_cwd ( ) ) . await {
313
+ if check_if_git_repo_dirty ( self . cli_options . initial_cwd ( ) )
314
+ . await
315
+ . is_some ( )
316
+ {
310
317
bail ! ( "When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo must be in a clean state." ) ;
311
318
}
312
319
@@ -1130,10 +1137,10 @@ fn verify_version_manifest(
1130
1137
Ok ( ( ) )
1131
1138
}
1132
1139
1133
- async fn check_if_git_repo_dirty ( cwd : & Path ) -> bool {
1140
+ async fn check_if_git_repo_dirty ( cwd : & Path ) -> Option < String > {
1134
1141
let bin_name = if cfg ! ( windows) { "git.exe" } else { "git" } ;
1135
1142
1136
- // Check if git exists
1143
+ // Check if git exists
1137
1144
let git_exists = Command :: new ( bin_name)
1138
1145
. arg ( "--version" )
1139
1146
. stderr ( Stdio :: null ( ) )
@@ -1143,7 +1150,7 @@ async fn check_if_git_repo_dirty(cwd: &Path) -> bool {
1143
1150
. map_or ( false , |status| status. success ( ) ) ;
1144
1151
1145
1152
if !git_exists {
1146
- return false ; // Git is not installed
1153
+ return None ; // Git is not installed
1147
1154
}
1148
1155
1149
1156
// Check if there are uncommitted changes
@@ -1155,7 +1162,12 @@ async fn check_if_git_repo_dirty(cwd: &Path) -> bool {
1155
1162
. expect ( "Failed to execute command" ) ;
1156
1163
1157
1164
let output_str = String :: from_utf8_lossy ( & output. stdout ) ;
1158
- !output_str. trim ( ) . is_empty ( )
1165
+ let text = output_str. trim ( ) ;
1166
+ if text. is_empty ( ) {
1167
+ None
1168
+ } else {
1169
+ Some ( text. to_string ( ) )
1170
+ }
1159
1171
}
1160
1172
1161
1173
#[ allow( clippy:: print_stderr) ]
0 commit comments