Skip to content

Commit

Permalink
Merge pull request #5831 from gitbutlerapp/dont-delete-workspace-bran…
Browse files Browse the repository at this point in the history
…ch-when-not-in-workspace

Don't delete workspace branch
  • Loading branch information
Caleb-T-Owens authored Dec 12, 2024
2 parents 78d76e9 + abfb663 commit 338133e
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions crates/gitbutler-watcher/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ use gitbutler_branch_actions::{internal::StackListResult, VirtualBranches};
use gitbutler_command_context::CommandContext;
use gitbutler_diff::DiffByPathMap;
use gitbutler_error::error::Marker;
use gitbutler_operating_modes::{
in_open_workspace_mode, in_outside_workspace_mode, operating_mode,
};
use gitbutler_operating_modes::{in_open_workspace_mode, operating_mode};
use gitbutler_oplog::{
entry::{OperationKind, SnapshotDetails},
OplogExt,
};
use gitbutler_project::{self as projects, Project, ProjectId};
use gitbutler_reference::{LocalRefname, Refname};
use gitbutler_sync::cloud::{push_oplog, push_repo};
use gitbutler_user as users;
use tracing::instrument;
Expand Down Expand Up @@ -197,16 +194,6 @@ impl Handler {
let ctx = CommandContext::open(&project)
.context("Failed to create a command context")?;

// If the user has left gitbutler/workspace, we want to delete the reference.
// TODO: why do we want to do this?
if in_outside_workspace_mode(&ctx) {
let mut workspace_reference = ctx.repo().find_reference(
&Refname::from(LocalRefname::new("gitbutler/workspace", None))
.to_string(),
)?;
workspace_reference.delete()?;
}

let head_ref = ctx.repo().head().context("failed to get head")?;
if let Some(head) = head_ref.name() {
self.emit_app_event(Change::GitHead {
Expand Down

0 comments on commit 338133e

Please sign in to comment.