@@ -5218,6 +5218,118 @@ fn dependent_branch_on_base() -> anyhow::Result<()> {
52185218 Ok ( ( ) )
52195219}
52205220
5221+ #[ test]
5222+ fn remote_and_integrated_tracking_branch_on_merge ( ) -> anyhow:: Result < ( ) > {
5223+ let ( repo, mut meta) = read_only_in_memory_scenario ( "ws/remote-and-integrated-tracking" ) ?;
5224+ insta:: assert_snapshot!( visualize_commit_graph_all( & repo) ?, @r"
5225+ * d018f71 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
5226+ | * c1e26b0 (origin/main, main) M-advanced
5227+ |/
5228+ | * 2181501 (origin/A) A-remote
5229+ |/
5230+ * 1ee1e34 (A) M-base
5231+ |\
5232+ | * efc3b77 (tmp1) X
5233+ * | c822d66 Y
5234+ |/
5235+ * bce0c5e M2
5236+ * 3183e43 M1
5237+ " ) ;
5238+ add_stack_with_segments ( & mut meta, 1 , "A" , StackState :: InWorkspace , & [ ] ) ;
5239+
5240+ let graph = Graph :: from_head (
5241+ & repo,
5242+ & * meta,
5243+ standard_options ( ) . with_extra_target_commit_id ( repo. rev_parse_single ( "origin/main" ) ?) ,
5244+ ) ?
5245+ . validated ( ) ?;
5246+ // TODO: this shouldn't move past the base on 1ee1e34!
5247+ insta:: assert_snapshot!( graph_workspace( & graph. to_workspace( ) ?) , @r"
5248+ 📕🏘️:0:gitbutler/workspace <> ✓refs/remotes/origin/main⇣1 on 1ee1e34
5249+ └── ≡📙:3:A <> origin/A →:4:⇣1 {1}
5250+ └── 📙:3:A <> origin/A →:4:⇣1
5251+ ├── 🟣2181501
5252+ ├── ❄️1ee1e34 (🏘️|✓)
5253+ ├── ❄️c822d66 (🏘️|✓)
5254+ ├── ❄️bce0c5e (🏘️|✓)
5255+ └── ❄️3183e43 (🏘️|✓)
5256+ " ) ;
5257+
5258+ Ok ( ( ) )
5259+ }
5260+
5261+ #[ test]
5262+ fn remote_and_integrated_tracking_branch_on_linear_segment ( ) -> anyhow:: Result < ( ) > {
5263+ let ( repo, mut meta) =
5264+ read_only_in_memory_scenario ( "ws/remote-and-integrated-tracking-linear" ) ?;
5265+ insta:: assert_snapshot!( visualize_commit_graph_all( & repo) ?, @r"
5266+ * 21e584f (HEAD -> gitbutler/workspace) GitButler Workspace Commit
5267+ | * 8dc508f (origin/main, main) M-advanced
5268+ |/
5269+ | * 197ddce (origin/A) A-remote
5270+ |/
5271+ * 081bae9 (A) M-base
5272+ * 3183e43 M1
5273+ " ) ;
5274+ add_stack_with_segments ( & mut meta, 1 , "A" , StackState :: InWorkspace , & [ ] ) ;
5275+
5276+ let graph = Graph :: from_head (
5277+ & repo,
5278+ & * meta,
5279+ standard_options ( ) . with_extra_target_commit_id ( repo. rev_parse_single ( "origin/main" ) ?) ,
5280+ ) ?
5281+ . validated ( ) ?;
5282+ // TODO: Can we arbitrarily split the segment below the low base of all stacks to prevent
5283+ // it from going all the way down?
5284+ insta:: assert_snapshot!( graph_workspace( & graph. to_workspace( ) ?) , @r"
5285+ 📕🏘️:0:gitbutler/workspace <> ✓refs/remotes/origin/main⇣1 on 081bae9
5286+ └── ≡📙:3:A <> origin/A →:4:⇣1 {1}
5287+ └── 📙:3:A <> origin/A →:4:⇣1
5288+ ├── 🟣197ddce
5289+ ├── ❄️081bae9 (🏘️|✓)
5290+ └── ❄️3183e43 (🏘️|✓)
5291+ " ) ;
5292+
5293+ Ok ( ( ) )
5294+ }
5295+
5296+ #[ test]
5297+ fn remote_and_integrated_tracking_branch_on_merge_extra_target ( ) -> anyhow:: Result < ( ) > {
5298+ let ( repo, mut meta) =
5299+ read_only_in_memory_scenario ( "ws/remote-and-integrated-tracking-extra-commit" ) ?;
5300+ insta:: assert_snapshot!( visualize_commit_graph_all( & repo) ?, @r"
5301+ * 5f2810f (HEAD -> gitbutler/workspace) GitButler Workspace Commit
5302+ * 9f47a25 (A) A-local
5303+ | * c1e26b0 (origin/main, main) M-advanced
5304+ |/
5305+ | * 2181501 (origin/A) A-remote
5306+ |/
5307+ * 1ee1e34 M-base
5308+ |\
5309+ | * efc3b77 (tmp1) X
5310+ * | c822d66 Y
5311+ |/
5312+ * bce0c5e M2
5313+ * 3183e43 M1
5314+ " ) ;
5315+ add_stack_with_segments ( & mut meta, 1 , "A" , StackState :: InWorkspace , & [ ] ) ;
5316+ let graph = Graph :: from_head (
5317+ & repo,
5318+ & * meta,
5319+ standard_options ( ) . with_extra_target_commit_id ( repo. rev_parse_single ( "origin/main" ) ?) ,
5320+ ) ?
5321+ . validated ( ) ?;
5322+ insta:: assert_snapshot!( graph_workspace( & graph. to_workspace( ) ?) , @r"
5323+ 📕🏘️:0:gitbutler/workspace <> ✓refs/remotes/origin/main⇣1 on 1ee1e34
5324+ └── ≡📙:3:A <> origin/A →:4:⇡1⇣1 on 1ee1e34 {1}
5325+ └── 📙:3:A <> origin/A →:4:⇡1⇣1
5326+ ├── 🟣2181501
5327+ └── ·9f47a25 (🏘️)
5328+ " ) ;
5329+
5330+ Ok ( ( ) )
5331+ }
5332+
52215333#[ test]
52225334fn unapplied_branch_on_base ( ) -> anyhow:: Result < ( ) > {
52235335 let ( repo, mut meta) = read_only_in_memory_scenario ( "ws/unapplied-branch-on-base" ) ?;
0 commit comments