Skip to content

Commit 5f9c2e5

Browse files
committed
Rename gitbutler/integration -> gitbutler/workspace
1 parent 444b03f commit 5f9c2e5

File tree

17 files changed

+72
-59
lines changed

17 files changed

+72
-59
lines changed

apps/desktop/src/lib/components/NotOnGitButlerBranch.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<ProjectNameLabel projectName={project?.title} />
4949
</div>
5050
<p class="switchrepo__title text-18 text-body text-bold">
51-
Looks like you've switched away from <span class="code-string"> gitbutler/integration </span>
51+
Looks like you've switched away from <span class="code-string"> gitbutler/workspace </span>
5252
</p>
5353

5454
<p class="switchrepo__message text-13 text-body">
@@ -69,7 +69,7 @@
6969
if (baseBranch) branchController.setTarget(baseBranch.branchName);
7070
}}
7171
>
72-
Go back to gitbutler/integration
72+
Go back to gitbutler/workspace
7373
</Button>
7474

7575
{#if project}

crates/gitbutler-branch-actions/src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::{anyhow, Context, Result};
44
use git2::Index;
55
use gitbutler_branch::{
66
self, Branch, BranchId, BranchOwnershipClaims, Target, VirtualBranchesHandle,
7-
GITBUTLER_INTEGRATION_REFERENCE,
7+
GITBUTLER_WORKSPACE_REFERENCE,
88
};
99
use gitbutler_command_context::CommandContext;
1010
use gitbutler_error::error::Marker;
@@ -176,7 +176,7 @@ pub(crate) fn set_base_branch(
176176
.context("Failed to get HEAD reference name")?;
177177
if !head_name
178178
.to_string()
179-
.eq(&GITBUTLER_INTEGRATION_REFERENCE.to_string())
179+
.eq(&GITBUTLER_WORKSPACE_REFERENCE.to_string())
180180
{
181181
// if there are any commits on the head branch or uncommitted changes in the working directory, we need to
182182
// put them into a virtual branch

crates/gitbutler-branch-actions/src/branch.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn combine_branches(
167167
let Some(identity) = branch.identity(&remotes) else {
168168
continue;
169169
};
170-
// Skip branches that should not be listed, e.g. the target 'main' or the gitbutler technical branches like 'gitbutler/integration'
170+
// Skip branches that should not be listed, e.g. the target 'main' or the gitbutler technical branches like 'gitbutler/workspace'
171171
if !should_list_git_branch(&identity) {
172172
continue;
173173
}
@@ -358,7 +358,8 @@ impl GroupBranch<'_> {
358358
fn should_list_git_branch(identity: &BranchIdentity) -> bool {
359359
// Exclude gitbutler technical branches (not useful for the user)
360360
const TECHNICAL_IDENTITIES: &[&[u8]] = &[
361-
b"gitbutler/integration",
361+
b"gitbutler/workspace",
362+
b"gitbutler/integration", // Remove me after transition.
362363
b"gitbutler/target",
363364
b"gitbutler/oplog",
364365
b"HEAD",

crates/gitbutler-branch-actions/src/integration.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ use anyhow::{anyhow, Context, Result};
44
use bstr::ByteSlice;
55
use gitbutler_branch::{
66
self, Branch, BranchCreateRequest, SignaturePurpose, VirtualBranchesHandle,
7-
GITBUTLER_INTEGRATION_REFERENCE,
7+
GITBUTLER_WORKSPACE_REFERENCE,
88
};
99
use gitbutler_cherry_pick::RepositoryExt as _;
1010
use gitbutler_command_context::CommandContext;
1111
use gitbutler_commit::commit_ext::CommitExt;
1212
use gitbutler_error::error::Marker;
13+
use gitbutler_operating_modes::OPEN_WORKSPACE_REFS;
1314
use gitbutler_project::access::WorktreeWritePermission;
1415
use gitbutler_repo::{LogUntil, RepoActionsExt, RepositoryExt};
1516
use tracing::instrument;
@@ -94,9 +95,9 @@ pub(crate) fn get_workspace_head(ctx: &CommandContext) -> Result<git2::Oid> {
9495
Ok(workspace_head_id)
9596
}
9697

97-
// Before switching the user to our gitbutler integration branch we save
98+
// Before switching the user to our gitbutler workspace branch we save
9899
// the current branch into a text file. It is used in generating the commit
99-
// message for integration branch, as a helpful hint about how to get back
100+
// message for workspace branch, as a helpful hint about how to get back
100101
// to where you were.
101102
struct PreviousHead {
102103
head: String,
@@ -138,8 +139,8 @@ pub fn update_gitbutler_integration(
138139
let integration_filepath = repo.path().join("integration");
139140
let mut prev_branch = read_integration_file(&integration_filepath)?;
140141
if let Some(branch) = &prev_branch {
141-
if branch.head != GITBUTLER_INTEGRATION_REFERENCE.to_string() {
142-
// we are moving from a regular branch to our gitbutler integration branch, write a file to
142+
if branch.head != GITBUTLER_WORKSPACE_REFERENCE.to_string() {
143+
// we are moving from a regular branch to our gitbutler workspace branch, write a file to
143144
// .git/integration with the previous head and name
144145
write_integration_file(&head_ref, integration_filepath)?;
145146
prev_branch = Some(PreviousHead {
@@ -218,14 +219,14 @@ pub fn update_gitbutler_integration(
218219
parents.iter().collect::<Vec<_>>().as_slice(),
219220
)?;
220221

221-
// Create or replace the integration branch reference, then set as HEAD.
222+
// Create or replace the workspace branch reference, then set as HEAD.
222223
repo.reference(
223-
&GITBUTLER_INTEGRATION_REFERENCE.clone().to_string(),
224+
&GITBUTLER_WORKSPACE_REFERENCE.clone().to_string(),
224225
final_commit,
225226
true,
226227
"updated integration commit",
227228
)?;
228-
repo.set_head(&GITBUTLER_INTEGRATION_REFERENCE.clone().to_string())?;
229+
repo.set_head(&GITBUTLER_WORKSPACE_REFERENCE.clone().to_string())?;
229230

230231
let mut index = repo.index()?;
231232
index.read_tree(&workspace_tree)?;
@@ -285,21 +286,21 @@ fn verify_head_is_set(ctx: &CommandContext) -> Result<()> {
285286
.context("failed to get head")?
286287
.name()
287288
{
288-
Some(refname) if *refname == GITBUTLER_INTEGRATION_REFERENCE.to_string() => Ok(()),
289+
Some(refname) if OPEN_WORKSPACE_REFS.contains(&refname) => Ok(()),
289290
Some(head_name) => Err(invalid_head_err(head_name)),
290291
None => Err(anyhow!(
291292
"project in detached head state. Please checkout {} to continue",
292-
GITBUTLER_INTEGRATION_REFERENCE.branch()
293+
GITBUTLER_WORKSPACE_REFERENCE.branch()
293294
)),
294295
}
295296
}
296297

297-
// Returns an error if repo head is not pointing to the integration branch.
298+
// Returns an error if repo head is not pointing to the workspace branch.
298299
fn verify_current_branch_name(ctx: &CommandContext) -> Result<&CommandContext> {
299300
match ctx.repository().head()?.name() {
300301
Some(head) => {
301302
let head_name = head.to_string();
302-
if head_name != GITBUTLER_INTEGRATION_REFERENCE.to_string() {
303+
if !OPEN_WORKSPACE_REFS.contains(&head_name.as_str()) {
303304
return Err(invalid_head_err(&head_name));
304305
}
305306
Ok(ctx)
@@ -408,6 +409,6 @@ fn verify_head_is_clean(ctx: &CommandContext, perm: &mut WorktreeWritePermission
408409
fn invalid_head_err(head_name: &str) -> anyhow::Error {
409410
anyhow!(
410411
"project is on {head_name}. Please checkout {} to continue",
411-
GITBUTLER_INTEGRATION_REFERENCE.branch()
412+
GITBUTLER_WORKSPACE_REFERENCE.branch()
412413
)
413414
}

crates/gitbutler-branch-actions/src/remote.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ pub fn list_local_branches(ctx: &CommandContext) -> Result<Vec<RemoteBranch>> {
8383
continue;
8484
}
8585
};
86-
8786
let branch_is_trunk = branch.name.branch() == Some(default_target.branch.branch())
8887
&& branch.name.remote() == Some(default_target.branch.remote());
8988

9089
if !branch_is_trunk
91-
&& branch.name.branch() != Some("gitbutler/integration")
90+
&& branch.name.branch() != Some("gitbutler/integration") // Remove after rename migration complete.
91+
&& branch.name.branch() != Some("gitbutler/workspace")
9292
&& branch.name.branch() != Some("gitbutler/target")
9393
{
9494
remote_branches.push(branch);

crates/gitbutler-branch-actions/tests/extra/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ fn detect_mergeable_branch() -> Result<()> {
13091309
std::fs::remove_file(Path::new(&project.path).join(file_path3))?;
13101310

13111311
ctx.repository()
1312-
.set_head("refs/heads/gitbutler/integration")?;
1312+
.set_head("refs/heads/gitbutler/workspace")?;
13131313
ctx.repository()
13141314
.checkout_head(Some(&mut git2::build::CheckoutBuilder::default().force()))?;
13151315

@@ -1986,7 +1986,7 @@ fn verify_branch_not_integration() -> Result<()> {
19861986
assert!(verify_result.is_err());
19871987
assert_eq!(
19881988
format!("{:#}", verify_result.unwrap_err()),
1989-
"<verification-failed>: project is on refs/heads/master. Please checkout gitbutler/integration to continue"
1989+
"<verification-failed>: project is on refs/heads/master. Please checkout gitbutler/workspace to continue"
19901990
);
19911991

19921992
Ok(())

crates/gitbutler-branch-actions/tests/virtual_branches/create_virtual_branch_from_branch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn integration() {
6868
std::fs::write(repository.path().join("another.txt"), "").unwrap();
6969
repository.commit_all("another");
7070
repository.push_branch(&"refs/heads/master".parse().unwrap());
71-
repository.checkout(&"refs/heads/gitbutler/integration".parse().unwrap());
71+
repository.checkout(&"refs/heads/gitbutler/workspace".parse().unwrap());
7272
}
7373

7474
{

crates/gitbutler-branch-actions/tests/virtual_branches/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn twice() {
3131
.set_base_branch(&project, &"refs/remotes/origin/master".parse().unwrap())
3232
.unwrap();
3333

34-
// even though project is on gitbutler/integration, we should not import it
34+
// even though project is on gitbutler/workspace, we should not import it
3535
assert!(controller
3636
.list_virtual_branches(&project)
3737
.unwrap()

crates/gitbutler-branch-actions/tests/virtual_branches/verify_branch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use gitbutler_reference::LocalRefname;
22

33
use super::*;
44

5-
// Ensures that `verify_branch` returns an error when not on the integration branch.
5+
// Ensures that `verify_branch` returns an error when not on the workspace branch.
66
#[test]
77
fn should_fail_on_incorrect_branch() {
88
let Test {
@@ -19,6 +19,6 @@ fn should_fail_on_incorrect_branch() {
1919
let err = result.unwrap_err();
2020
assert_eq!(
2121
format!("{err:#}"),
22-
"<verification-failed>: project is on refs/heads/somebranch. Please checkout gitbutler/integration to continue"
22+
"<verification-failed>: project is on refs/heads/somebranch. Please checkout gitbutler/workspace to continue"
2323
);
2424
}

crates/gitbutler-branch/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ mod state;
2323
use lazy_static::lazy_static;
2424
pub use state::{VirtualBranches as VirtualBranchesState, VirtualBranchesHandle};
2525
lazy_static! {
26-
pub static ref GITBUTLER_INTEGRATION_REFERENCE: gitbutler_reference::LocalRefname =
27-
gitbutler_reference::LocalRefname::new("gitbutler/integration", None);
26+
pub static ref GITBUTLER_WORKSPACE_REFERENCE: gitbutler_reference::LocalRefname =
27+
gitbutler_reference::LocalRefname::new("gitbutler/workspace", None);
2828
}
2929

3030
pub const GITBUTLER_COMMIT_AUTHOR_NAME: &str = "GitButler";

0 commit comments

Comments
 (0)