@@ -634,6 +634,58 @@ fn minimal_merge() -> anyhow::Result<()> {
634
634
Ok ( ( ) )
635
635
}
636
636
637
+ #[ test]
638
+ fn stack_configuration_is_respected_if_one_of_them_is_an_entrypoint ( ) -> anyhow:: Result < ( ) > {
639
+ let ( repo, mut meta) = read_only_in_memory_scenario ( "ws/just-init-with-two-branches" ) ?;
640
+ insta:: assert_snapshot!( visualize_commit_graph_all( & repo) ?, @"* fafd9d0 (HEAD -> gitbutler/workspace, main, B, A) init" ) ;
641
+
642
+ add_stack_with_segments ( & mut meta, 1 , "A" , StackState :: InWorkspace , & [ ] ) ;
643
+ add_stack_with_segments ( & mut meta, 2 , "B" , StackState :: InWorkspace , & [ ] ) ;
644
+
645
+ let graph = Graph :: from_head (
646
+ & repo,
647
+ & * meta,
648
+ standard_options_with_extra_target ( & repo, "main" ) ,
649
+ ) ?
650
+ . validated ( ) ?;
651
+ insta:: assert_snapshot!( graph_tree( & graph) , @r"
652
+ └── 👉📕►►►:0[0]:gitbutler/workspace
653
+ ├── 📙►:2[1]:A
654
+ │ └── ►:1[2]:anon:
655
+ │ └── ·fafd9d0 (⌂|🏘️|1) ►main
656
+ └── 📙►:3[1]:B
657
+ └── →:1:
658
+ " ) ;
659
+ insta:: assert_snapshot!( graph_workspace( & graph. to_workspace( ) ?) , @r"
660
+ 📕🏘️⚠️:0:gitbutler/workspace <> ✓! on fafd9d0
661
+ ├── ≡📙:3:B on fafd9d0
662
+ │ └── 📙:3:B
663
+ └── ≡📙:2:A on fafd9d0
664
+ └── 📙:2:A
665
+ " ) ;
666
+
667
+ let ( id, ref_name) = id_at ( & repo, "B" ) ;
668
+ let graph = Graph :: from_commit_traversal ( id, ref_name. clone ( ) , & * meta, standard_options ( ) ) ?
669
+ . validated ( ) ?;
670
+ // TODO: it shouldn't create a dependent branch here, but instead see A as a stack.
671
+ // problem is that for stack creation, there is no candidate.
672
+ insta:: assert_snapshot!( graph_tree( & graph) , @r"
673
+ └── 📕►►►:1[0]:gitbutler/workspace
674
+ └── 👉📙►:0[1]:B
675
+ └── 📙►:2[2]:A
676
+ └── ·fafd9d0 (⌂|🏘️|1) ►main
677
+ " ) ;
678
+ insta:: assert_snapshot!( graph_workspace( & graph. to_workspace( ) ?) , @r"
679
+ 📕🏘️⚠️:1:gitbutler/workspace <> ✓!
680
+ └── ≡👉📙:0:B
681
+ ├── 👉📙:0:B
682
+ └── 📙:2:A
683
+ └── ·fafd9d0 (🏘️) ►main
684
+ " ) ;
685
+
686
+ Ok ( ( ) )
687
+ }
688
+
637
689
#[ test]
638
690
fn just_init_with_branches ( ) -> anyhow:: Result < ( ) > {
639
691
let ( repo, mut meta) = read_only_in_memory_scenario ( "ws/just-init-with-branches" ) ?;
0 commit comments