@@ -368,3 +368,67 @@ fn test_status_simplify_conflict_sides() {
368
368
Then run `jj squash` to move the resolution into the conflicted commit.
369
369
"### ) ;
370
370
}
371
+
372
+ #[ test]
373
+ fn test_status_untracked_files ( ) {
374
+ let test_env = TestEnvironment :: default ( ) ;
375
+ test_env. add_config ( r#"snapshot.auto-track = "none()""# ) ;
376
+
377
+ test_env. jj_cmd_ok ( test_env. env_root ( ) , & [ "git" , "init" , "repo" ] ) ;
378
+ let repo_path = test_env. env_root ( ) . join ( "repo" ) ;
379
+
380
+ std:: fs:: write ( repo_path. join ( "initially-untracked-file" ) , "..." ) . unwrap ( ) ;
381
+ std:: fs:: write ( repo_path. join ( "always-untracked-file" ) , "..." ) . unwrap ( ) ;
382
+
383
+ let stdout = test_env. jj_cmd_success ( & repo_path, & [ "status" ] ) ;
384
+ insta:: assert_snapshot!( stdout, @r"
385
+ The working copy is clean
386
+ ? always-untracked-file
387
+ ? initially-untracked-file
388
+ Working copy : qpvuntsm 230dd059 (empty) (no description set)
389
+ Parent commit: zzzzzzzz 00000000 (empty) (no description set)
390
+ " ) ;
391
+
392
+ test_env. jj_cmd_success ( & repo_path, & [ "file" , "track" , "initially-untracked-file" ] ) ;
393
+
394
+ let stdout = test_env. jj_cmd_success ( & repo_path, & [ "status" ] ) ;
395
+ insta:: assert_snapshot!( stdout, @r"
396
+ Working copy changes:
397
+ A initially-untracked-file
398
+ ? always-untracked-file
399
+ Working copy : qpvuntsm 203bfea9 (no description set)
400
+ Parent commit: zzzzzzzz 00000000 (empty) (no description set)
401
+ " ) ;
402
+
403
+ test_env. jj_cmd_ok ( & repo_path, & [ "new" ] ) ;
404
+
405
+ let stdout = test_env. jj_cmd_success ( & repo_path, & [ "status" ] ) ;
406
+ insta:: assert_snapshot!( stdout, @r"
407
+ The working copy is clean
408
+ ? always-untracked-file
409
+ Working copy : mzvwutvl 69b48d55 (empty) (no description set)
410
+ Parent commit: qpvuntsm 203bfea9 (no description set)
411
+ " ) ;
412
+
413
+ test_env. jj_cmd_success ( & repo_path, & [ "file" , "untrack" , "initially-untracked-file" ] ) ;
414
+ let stdout = test_env. jj_cmd_success ( & repo_path, & [ "status" ] ) ;
415
+ insta:: assert_snapshot!( stdout, @r"
416
+ Working copy changes:
417
+ D initially-untracked-file
418
+ ? always-untracked-file
419
+ ? initially-untracked-file
420
+ Working copy : mzvwutvl 16169825 (no description set)
421
+ Parent commit: qpvuntsm 203bfea9 (no description set)
422
+ " ) ;
423
+
424
+ test_env. jj_cmd_ok ( & repo_path, & [ "new" ] ) ;
425
+
426
+ let stdout = test_env. jj_cmd_success ( & repo_path, & [ "status" ] ) ;
427
+ insta:: assert_snapshot!( stdout, @r"
428
+ The working copy is clean
429
+ ? always-untracked-file
430
+ ? initially-untracked-file
431
+ Working copy : yostqsxw 9b87b665 (empty) (no description set)
432
+ Parent commit: mzvwutvl 16169825 (no description set)
433
+ " ) ;
434
+ }
0 commit comments