@@ -4231,6 +4231,68 @@ fn history_grep_substring_finds_pattern_across_library() {
42314231 assert ! ( out. contains( "bbbbcccc" ) , "{out}" ) ;
42324232}
42334233
4234+ #[ test]
4235+ fn history_grep_scope_and_all_match_list_semantics ( ) {
4236+ let temp = repo_tempdir ( ) ;
4237+ let repo_a = clean_git_repo ( & temp) ;
4238+ let repo_b = temp. path ( ) . join ( "repo-b" ) ;
4239+ fs:: create_dir_all ( & repo_b) . expect ( "repo b" ) ;
4240+ git ( & repo_b, & [ "init" ] ) . expect ( "git init b" ) ;
4241+ fs:: write ( repo_b. join ( "README.md" ) , "hello b" ) . expect ( "readme b" ) ;
4242+ git ( & repo_b, & [ "add" , "-A" ] ) . expect ( "add b" ) ;
4243+ git ( & repo_b, & [ "commit" , "-m" , "initial b" ] ) . expect ( "commit b" ) ;
4244+ let paths = DeadreckonPaths :: from_home ( temp. path ( ) . join ( "home" ) ) ;
4245+ seed_trace_run (
4246+ & paths,
4247+ & repo_a,
4248+ "aaaa1111ccccdddd1111222233334444" ,
4249+ "scope-history-needle repo a" ,
4250+ ) ;
4251+ seed_trace_run (
4252+ & paths,
4253+ & repo_b,
4254+ "bbbb2222eeeeffff5555666677778888" ,
4255+ "scope-history-needle repo b" ,
4256+ ) ;
4257+ let scope_b = deadreckon_core:: paths:: workspace_scope ( & repo_b) . expect ( "scope b" ) ;
4258+
4259+ let scoped_default = deadreckon ( & paths)
4260+ . current_dir ( & repo_a)
4261+ . args ( [ "history" , "grep" , "scope-history-needle" ] )
4262+ . output ( )
4263+ . expect ( "history grep scoped" ) ;
4264+ assert_success ( & scoped_default) ;
4265+ let out = stdout ( & scoped_default) ;
4266+ assert ! ( out. contains( "aaaa1111" ) , "{out}" ) ;
4267+ assert ! ( !out. contains( "bbbb2222" ) , "{out}" ) ;
4268+
4269+ let explicit_scope = deadreckon ( & paths)
4270+ . current_dir ( & repo_a)
4271+ . args ( [
4272+ "history" ,
4273+ "grep" ,
4274+ "scope-history-needle" ,
4275+ "--scope" ,
4276+ & scope_b,
4277+ ] )
4278+ . output ( )
4279+ . expect ( "history grep scope" ) ;
4280+ assert_success ( & explicit_scope) ;
4281+ let out = stdout ( & explicit_scope) ;
4282+ assert ! ( !out. contains( "aaaa1111" ) , "{out}" ) ;
4283+ assert ! ( out. contains( "bbbb2222" ) , "{out}" ) ;
4284+
4285+ let all_scopes = deadreckon ( & paths)
4286+ . current_dir ( & repo_a)
4287+ . args ( [ "history" , "grep" , "scope-history-needle" , "--all" ] )
4288+ . output ( )
4289+ . expect ( "history grep all" ) ;
4290+ assert_success ( & all_scopes) ;
4291+ let out = stdout ( & all_scopes) ;
4292+ assert ! ( out. contains( "aaaa1111" ) , "{out}" ) ;
4293+ assert ! ( out. contains( "bbbb2222" ) , "{out}" ) ;
4294+ }
4295+
42344296#[ test]
42354297fn history_grep_plan_scope_excludes_others ( ) {
42364298 let temp = repo_tempdir ( ) ;
0 commit comments