@@ -217,7 +217,8 @@ export class JJ {
217217 }
218218
219219 // Search by description and bookmarks
220- const escaped = query . replace ( / " / g, '\\"' ) ;
220+ // Escape backslashes first, then quotes
221+ const escaped = query . replace ( / \\ / g, "\\\\" ) . replace ( / " / g, '\\"' ) ;
221222 const revset = options . includeBookmarks
222223 ? `description(substring-i:"${ escaped } ") | bookmarks(substring-i:"${ escaped } ")`
223224 : `description(substring-i:"${ escaped } ")` ;
@@ -601,7 +602,9 @@ export class JJ {
601602 if ( stack . changeCount !== 1 ) return true ;
602603 const only = stack . changes [ 0 ] ;
603604 if ( ! only . isWorkingCopy ) return true ;
604- return ! only . isEmpty || only . description . trim ( ) !== "" || only . hasConflicts ;
605+ return (
606+ ! only . isEmpty || only . description . trim ( ) !== "" || only . hasConflicts
607+ ) ;
605608 } ) ;
606609
607610 // Sort by whether it contains current, then by timestamp
@@ -849,9 +852,15 @@ export class JJ {
849852 }
850853
851854 async exitToGit ( ) : Promise < Result < { trunk : string } > > {
852- const result = await this . executor . execute ( "git" , [ "checkout" , this . trunk ] , { cwd : this . cwd } ) ;
855+ const result = await this . executor . execute (
856+ "git" ,
857+ [ "checkout" , this . trunk ] ,
858+ { cwd : this . cwd } ,
859+ ) ;
853860 if ( result . exitCode !== 0 ) {
854- return err ( createError ( "COMMAND_FAILED" , result . stderr || "git checkout failed" ) ) ;
861+ return err (
862+ createError ( "COMMAND_FAILED" , result . stderr || "git checkout failed" ) ,
863+ ) ;
855864 }
856865 return ok ( { trunk : this . trunk } ) ;
857866 }
0 commit comments