Skip to content

Commit b935042

Browse files
authored
Merge pull request #9473 from gitbutlerapp/refactor-claude-branch-name-gen
refactor: remove existing_branch_names from rename_branch
2 parents 8d5c89d + 949fe05 commit b935042

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

crates/but-action/src/rename_branch.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub struct RenameBranchParams {
1111
pub commit_message: String,
1212
pub stack_id: StackId,
1313
pub current_branch_name: String,
14-
pub existing_branch_names: Vec<String>,
1514
}
1615

1716
pub async fn rename_branch(
@@ -25,10 +24,14 @@ pub async fn rename_branch(
2524
commit_message,
2625
stack_id,
2726
current_branch_name,
28-
existing_branch_names,
2927
} = parameters;
3028

3129
let repo = &ctx.gix_repo_for_merging_non_persisting()?;
30+
let stacks = crate::stacks(ctx, repo)?;
31+
let existing_branch_names = stacks
32+
.iter()
33+
.flat_map(|s| s.heads.iter().map(|h| h.name.clone().to_string()))
34+
.collect::<Vec<_>>();
3235
let changes = but_core::diff::ui::commit_changes_by_worktree_dir(repo, commit_id)?;
3336
let diff = changes.try_as_unidiff_string(repo, ctx.app_settings().context_lines)?;
3437
let diffs = vec![diff];

crates/but/src/command/claude.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ pub(crate) async fn handle_stop() -> anyhow::Result<ClaudeHookOutput> {
112112
)?;
113113

114114
let stacks = crate::log::stacks(defer.ctx)?;
115-
let existing_branch_names = stacks
116-
.iter()
117-
.flat_map(|s| s.heads.iter().map(|h| h.name.clone().to_string()))
118-
.collect::<Vec<_>>();
119115

120116
// Trigger commit message generation for newly created commits
121117
// TODO: Maybe this can be done in the main app process i.e. the GitButler GUI, if avaialbe
@@ -162,7 +158,6 @@ pub(crate) async fn handle_stop() -> anyhow::Result<ClaudeHookOutput> {
162158
commit_message,
163159
stack_id: branch.stack_id,
164160
current_branch_name: branch.branch_name.clone(),
165-
existing_branch_names: existing_branch_names.clone(),
166161
};
167162
but_action::rename_branch::rename_branch(
168163
defer.ctx,

0 commit comments

Comments
 (0)