File tree Expand file tree Collapse file tree 4 files changed +51
-1
lines changed
gitbutler-branch-actions/tests
gitbutler-operating-modes/src Expand file tree Collapse file tree 4 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -eu -o pipefail
3+ CLI=${1:? The first argument is the GitButler CLI}
4+
5+ git init remote
6+ (cd remote
7+ echo first > file
8+ git add . && git commit -m " init"
9+ )
10+
11+ export GITBUTLER_CLI_DATA_DIR=../user/gitbutler/app-data
12+ git clone remote workspace-migration
13+ (cd workspace-migration
14+ $CLI project add --switch-to-workspace " $( git rev-parse --symbolic-full-name @{u}) "
15+ $CLI branch create virtual
16+ # Start the test on the old integration branch.
17+ git checkout -b gitbutler/integration
18+ )
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ mod update_base_branch;
8282mod update_commit_message;
8383mod upstream;
8484mod verify_branch;
85+ mod workspace_migration;
8586
8687#[ test]
8788fn resolve_conflict_flow ( ) {
Original file line number Diff line number Diff line change 1+ use gitbutler_branch:: VirtualBranchesHandle ;
2+ use gitbutler_branch_actions:: { update_workspace_commit, verify_branch} ;
3+ use gitbutler_operating_modes:: { INTEGRATION_BRANCH_REF , WORKSPACE_BRANCH_REF } ;
4+
5+ /// Tests that "verify branch" won't complain if we are on the old integration
6+ /// branch, and that `update_workspace_commit` will put us back on the a branch
7+ /// with the new name.
8+ #[ test]
9+ fn works_on_integration_branch ( ) -> anyhow:: Result < ( ) > {
10+ let ctx = gitbutler_testsupport:: read_only:: fixture (
11+ "for-workspace-migration.sh" ,
12+ "workspace-migration" ,
13+ ) ?;
14+ let mut guard = ctx. project ( ) . exclusive_worktree_access ( ) ;
15+ let perm = guard. write_permission ( ) ;
16+
17+ // Check that we are on the old `gitbutler/integration` branch.
18+ assert_eq ! (
19+ ctx. repository( ) . head( ) ?. name( ) ,
20+ Some ( INTEGRATION_BRANCH_REF )
21+ ) ;
22+
23+ // Should not throw verification error until migration is complete.
24+ let result = verify_branch ( & ctx, perm) ;
25+ assert ! ( result. is_ok( ) ) ;
26+
27+ // Updating workspace commit should put us on the workspace branch.
28+ update_workspace_commit ( & VirtualBranchesHandle :: new ( ctx. project ( ) . gb_dir ( ) ) , & ctx) ?;
29+ assert_eq ! ( ctx. repository( ) . head( ) ?. name( ) , Some ( WORKSPACE_BRANCH_REF ) ) ;
30+ Ok ( ( ) )
31+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ pub mod commands;
1111pub const WORKSPACE_BRANCH_REF : & str = "refs/heads/gitbutler/workspace" ;
1212
1313/// Previous workspace reference, delete after transition.
14- const INTEGRATION_BRANCH_REF : & str = "refs/heads/gitbutler/integration" ;
14+ pub const INTEGRATION_BRANCH_REF : & str = "refs/heads/gitbutler/integration" ;
1515
1616/// To prevent clients hitting the "looks like you've moved away from..."
1717/// after upgrading to a version using the new gitbutler/workspace branch
You can’t perform that action at this time.
0 commit comments