File tree 1 file changed +22
-1
lines changed 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -404,7 +404,28 @@ impl Command {
404
404
// We want to forward the host stdin so apparently we cannot use `cmd!`.
405
405
let mut cmd = process:: Command :: new ( "git" ) ;
406
406
cmd. arg ( "rebase" ) . arg ( & base) . arg ( "--interactive" ) ;
407
- cmd. env ( "GIT_SEQUENCE_EDITOR" , env:: current_exe ( ) ?) ;
407
+ let current_exe = {
408
+ if cfg ! ( windows) {
409
+ // Apparently git-for-Windows gets confused by backslashes if we just use
410
+ // `current_exe()` here. So replace them by forward slashes if this is not a "magic"
411
+ // path starting with "\\". This is clearly a git bug but we work around it here.
412
+ // Also see <https://github.com/rust-lang/miri/issues/4340>.
413
+ let bin = env:: current_exe ( ) ?;
414
+ match bin. into_os_string ( ) . into_string ( ) {
415
+ Err ( not_utf8) => not_utf8. into ( ) , // :shrug:
416
+ Ok ( str) => {
417
+ if str. starts_with ( r"\\" ) {
418
+ str. into ( ) // don't touch these magic paths, they must use backslashes
419
+ } else {
420
+ str. replace ( '\\' , "/" ) . into ( )
421
+ }
422
+ }
423
+ }
424
+ } else {
425
+ env:: current_exe ( ) ?
426
+ }
427
+ } ;
428
+ cmd. env ( "GIT_SEQUENCE_EDITOR" , current_exe) ;
408
429
cmd. env ( "MIRI_SCRIPT_IS_GIT_SEQUENCE_EDITOR" , "1" ) ;
409
430
cmd. current_dir ( sh. current_dir ( ) ) ;
410
431
let result = cmd. status ( ) ?;
You can’t perform that action at this time.
0 commit comments