@@ -1101,8 +1101,8 @@ fn test_git_push_changes_with_name(subprocess: bool) {
11011101 let test_env = TestEnvironment :: default ( ) ;
11021102 set_up ( & test_env) ;
11031103 let work_dir = test_env. work_dir ( "local" ) ;
1104- if subprocess {
1105- test_env. add_config ( "git.subprocess = true " ) ;
1104+ if ! subprocess {
1105+ test_env. add_config ( "git.subprocess = false " ) ;
11061106 }
11071107 work_dir. run_jj ( [ "describe" , "-m" , "foo" ] ) . success ( ) ;
11081108 work_dir. write_file ( "file" , "contents" ) ;
@@ -1240,8 +1240,8 @@ fn test_git_push_changes_with_name_deleted_tracked(subprocess: bool) {
12401240 // copy
12411241 test_env. add_config ( r#"revset-aliases."immutable_heads()" = "none()""# ) ;
12421242 let work_dir = test_env. work_dir ( "local" ) ;
1243- if subprocess {
1244- test_env. add_config ( "git.subprocess = true " ) ;
1243+ if ! subprocess {
1244+ test_env. add_config ( "git.subprocess = false " ) ;
12451245 }
12461246 // Create a second empty remote `another_remote`
12471247 test_env
@@ -1354,8 +1354,8 @@ fn test_git_push_changes_with_name_untracked_or_forgotten(subprocess: bool) {
13541354 let test_env = TestEnvironment :: default ( ) ;
13551355 set_up ( & test_env) ;
13561356 let work_dir = test_env. work_dir ( "local" ) ;
1357- if subprocess {
1358- test_env. add_config ( "git.subprocess = true " ) ;
1357+ if ! subprocess {
1358+ test_env. add_config ( "git.subprocess = false " ) ;
13591359 }
13601360 // Unset immutable_heads so that untracking branches does not move the working
13611361 // copy
@@ -1437,39 +1437,64 @@ fn test_git_push_changes_with_name_untracked_or_forgotten(subprocess: bool) {
14371437 insta:: assert_snapshot!( output, @"" ) ;
14381438 }
14391439
1440- // Make sure push still errors if we try to push a bookmark with the same name
1441- // to a different location.
14421440 let output = work_dir. run_jj ( [ "git" , "push" , "--named" , "b1=@+" ] ) ;
1443- insta:: allow_duplicates! {
1444- insta:: assert_snapshot!( output, @r"
1445- ------- stderr -------
1446- Changes to push to origin:
1447- Add bookmark b1 to c9c824c88955
1448- Error: Failed to push some bookmarks
1449- Hint: The following references unexpectedly moved on the remote:
1450- refs/heads/b1 (reason: stale info)
1451- Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.
1452- [EOF]
1453- [exit status: 1]
1454- " ) ;
1441+ if subprocess {
1442+ // Make sure push still errors if we try to push a bookmark with the same name
1443+ // to a different location.
1444+ insta:: assert_snapshot!( output, @r"
1445+ ------- stderr -------
1446+ Changes to push to origin:
1447+ Add bookmark b1 to c9c824c88955
1448+ Error: Failed to push some bookmarks
1449+ Hint: The following references unexpectedly moved on the remote:
1450+ refs/heads/b1 (reason: stale info)
1451+ Hint: Try fetching from the remote, then make the bookmark point to where you want it to be, and push again.
1452+ [EOF]
1453+ [exit status: 1]
1454+ " ) ;
1455+ } else {
1456+ // `git2` does something else.
1457+ insta:: assert_snapshot!( output, @r"
1458+ ------- stderr -------
1459+ Changes to push to origin:
1460+ Add bookmark b1 to c9c824c88955
1461+ [EOF]
1462+ " ) ;
14551463 }
14561464
1457- // The bookmark is still forgotten
14581465 let output = work_dir. run_jj ( [ "bookmark" , "list" , "--all" , "b1" ] ) ;
1459- insta:: allow_duplicates! {
1460- insta:: assert_snapshot!( output, @"" ) ;
1466+ if subprocess {
1467+ // The bookmark is still forgotten
1468+ insta:: assert_snapshot!( output, @"" ) ;
1469+ } else {
1470+ // `git2` continues to do something else.
1471+ insta:: assert_snapshot!( output, @r"
1472+ b1: yostqsxw c9c824c8 (empty) child
1473+ @origin: yostqsxw c9c824c8 (empty) child
1474+ [EOF]
1475+ " ) ;
14611476 }
1462- // In this case, pushing the bookmark to the same location where it already is
1463- // succeeds. TODO: This seems pretty safe, but perhaps it should still show
1464- // an error or some sort of warning?
14651477 let output = work_dir. run_jj ( [ "git" , "push" , "--named" , "b1=@" ] ) ;
1466- insta:: allow_duplicates! {
1467- insta:: assert_snapshot!( output, @r"
1468- ------- stderr -------
1469- Changes to push to origin:
1470- Add bookmark b1 to 10b6b209c4a3
1471- [EOF]
1472- " ) ;
1478+ if subprocess {
1479+ // In this case, pushing the bookmark to the same location where it already is
1480+ // succeeds. TODO: This seems pretty safe, but perhaps it should still show
1481+ // an error or some sort of warning?
1482+ insta:: assert_snapshot!( output, @r"
1483+ ------- stderr -------
1484+ Changes to push to origin:
1485+ Add bookmark b1 to 10b6b209c4a3
1486+ [EOF]
1487+ " ) ;
1488+ } else {
1489+ // `git2` remains an independent free‐thinker operating
1490+ // entirely on its own radically unique paradigm.
1491+ insta:: assert_snapshot!( output, @r"
1492+ ------- stderr -------
1493+ Error: Bookmark already exists: b1
1494+ Hint: Use 'jj bookmark move' to move it, and 'jj git push -b b1 [--allow-new]' to push it
1495+ [EOF]
1496+ [exit status: 1]
1497+ " ) ;
14731498 }
14741499}
14751500
0 commit comments