@@ -681,6 +681,58 @@ fn minimal_merge() -> anyhow::Result<()> {
681
681
Ok ( ( ) )
682
682
}
683
683
684
+ #[ test]
685
+ fn stack_configuration_is_respected_if_one_of_them_is_an_entrypoint ( ) -> anyhow:: Result < ( ) > {
686
+ let ( repo, mut meta) = read_only_in_memory_scenario ( "ws/just-init-with-two-branches" ) ?;
687
+ insta:: assert_snapshot!( visualize_commit_graph_all( & repo) ?, @"* fafd9d0 (HEAD -> gitbutler/workspace, main, B, A) init" ) ;
688
+
689
+ add_stack_with_segments ( & mut meta, 1 , "A" , StackState :: InWorkspace , & [ ] ) ;
690
+ add_stack_with_segments ( & mut meta, 2 , "B" , StackState :: InWorkspace , & [ ] ) ;
691
+
692
+ let graph = Graph :: from_head (
693
+ & repo,
694
+ & * meta,
695
+ standard_options_with_extra_target ( & repo, "main" ) ,
696
+ ) ?
697
+ . validated ( ) ?;
698
+ insta:: assert_snapshot!( graph_tree( & graph) , @r"
699
+ └── 👉📕►►►:0[0]:gitbutler/workspace
700
+ ├── 📙►:2[1]:A
701
+ │ └── ►:1[2]:anon:
702
+ │ └── ·fafd9d0 (⌂|🏘️|1) ►main
703
+ └── 📙►:3[1]:B
704
+ └── →:1:
705
+ " ) ;
706
+ insta:: assert_snapshot!( graph_workspace( & graph. to_workspace( ) ?) , @r"
707
+ 📕🏘️⚠️:0:gitbutler/workspace <> ✓! on fafd9d0
708
+ ├── ≡📙:3:B on fafd9d0
709
+ │ └── 📙:3:B
710
+ └── ≡📙:2:A on fafd9d0
711
+ └── 📙:2:A
712
+ " ) ;
713
+
714
+ let ( id, ref_name) = id_at ( & repo, "B" ) ;
715
+ let graph = Graph :: from_commit_traversal ( id, ref_name. clone ( ) , & * meta, standard_options ( ) ) ?
716
+ . validated ( ) ?;
717
+ // TODO: it shouldn't create a dependent branch here, but instead see A as a stack.
718
+ // problem is that for stack creation, there is no candidate.
719
+ insta:: assert_snapshot!( graph_tree( & graph) , @r"
720
+ └── 📕►►►:1[0]:gitbutler/workspace
721
+ └── 👉📙►:0[1]:B
722
+ └── 📙►:2[2]:A
723
+ └── ·fafd9d0 (⌂|🏘️|1) ►main
724
+ " ) ;
725
+ insta:: assert_snapshot!( graph_workspace( & graph. to_workspace( ) ?) , @r"
726
+ 📕🏘️⚠️:1:gitbutler/workspace <> ✓!
727
+ └── ≡👉📙:0:B
728
+ ├── 👉📙:0:B
729
+ └── 📙:2:A
730
+ └── ·fafd9d0 (🏘️) ►main
731
+ " ) ;
732
+
733
+ Ok ( ( ) )
734
+ }
735
+
684
736
#[ test]
685
737
fn just_init_with_branches ( ) -> anyhow:: Result < ( ) > {
686
738
let ( repo, mut meta) = read_only_in_memory_scenario ( "ws/just-init-with-branches" ) ?;
0 commit comments