Skip to content

Commit 146d639

Browse files
committed
Remove reference creation for namespaced branches
This is from before the time where we were using real branches in git. Now that we do that, these serve no purpose.
1 parent af9241c commit 146d639

File tree

1 file changed

+27
-33
lines changed

1 file changed

+27
-33
lines changed

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

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -246,40 +246,34 @@ pub fn update_workspace_commit(
246246
index.read_tree(&workspace_tree)?;
247247
index.write()?;
248248

249-
// finally, update the refs/gitbutler/ heads to the states of the current virtual branches
250-
for branch in &virtual_branches {
251-
let wip_tree = repo.find_tree(branch.tree(ctx)?)?;
252-
let mut branch_head = repo.find_commit(branch.head_oid(&gix_repo)?.to_git2())?;
253-
let head_tree = branch_head.tree()?;
254-
255-
// create a wip commit if there is wip
256-
if head_tree.id() != wip_tree.id() {
257-
let mut message = "GitButler WIP Commit".to_string();
258-
message.push_str("\n\n");
259-
message.push_str("This is a WIP commit for the virtual branch '");
260-
message.push_str(branch.name.as_str());
261-
message.push_str("'\n\n");
262-
message.push_str("This commit is used to store the state of the virtual branch\n");
263-
message.push_str("while you are working on it. It is not meant to be used for\n");
264-
message.push_str("anything else.\n\n");
265-
let branch_head_oid = repo.commit(
266-
None,
267-
&committer,
268-
&committer,
269-
&message,
270-
&wip_tree,
271-
&[&branch_head],
272-
// None,
273-
)?;
274-
branch_head = repo.find_commit(branch_head_oid)?;
249+
if !ctx.app_settings().feature_flags.v3 {
250+
// finally, update the refs/gitbutler/ heads to the states of the current virtual branches
251+
for branch in &virtual_branches {
252+
let wip_tree = repo.find_tree(branch.tree(ctx)?)?;
253+
let mut branch_head = repo.find_commit(branch.head_oid(&gix_repo)?.to_git2())?;
254+
let head_tree = branch_head.tree()?;
255+
256+
// create a wip commit if there is wip
257+
if head_tree.id() != wip_tree.id() {
258+
let mut message = "GitButler WIP Commit".to_string();
259+
message.push_str("\n\n");
260+
message.push_str("This is a WIP commit for the virtual branch '");
261+
message.push_str(branch.name.as_str());
262+
message.push_str("'\n\n");
263+
message.push_str("This commit is used to store the state of the virtual branch\n");
264+
message.push_str("while you are working on it. It is not meant to be used for\n");
265+
message.push_str("anything else.\n\n");
266+
let branch_head_oid = repo.commit(
267+
None,
268+
&committer,
269+
&committer,
270+
&message,
271+
&wip_tree,
272+
&[&branch_head],
273+
// None,
274+
)?;
275+
}
275276
}
276-
277-
repo.reference(
278-
&branch.refname()?.to_string(),
279-
branch_head.id(),
280-
true,
281-
"update virtual branch",
282-
)?;
283277
}
284278

285279
Ok(final_commit)

0 commit comments

Comments
 (0)