Skip to content

Commit f3e5228

Browse files
committed
Update workspace commit message
1 parent d217d96 commit f3e5228

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

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

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -161,34 +161,39 @@ pub fn update_gitbutler_integration(
161161
let workspace_head = repo.find_commit(get_workspace_head(ctx)?)?;
162162

163163
// message that says how to get back to where they were
164-
let mut message = GITBUTLER_INTEGRATION_COMMIT_TITLE.to_string();
164+
let mut message = GITBUTLER_WORKSPACE_COMMIT_TITLE.to_string();
165165
message.push_str("\n\n");
166-
message.push_str(
167-
"This is an integration commit for the virtual branches that GitButler is tracking.\n\n",
168-
);
166+
if !virtual_branches.is_empty() {
167+
message.push_str("This is an merge commit the virtual branches in your workspace.\n\n");
168+
} else {
169+
message.push_str("This is placeholder commit and will be replaced by a merge of your");
170+
message.push_str("virtual branches.\n\n");
171+
}
169172
message.push_str(
170173
"Due to GitButler managing multiple virtual branches, you cannot switch back and\n",
171174
);
172175
message.push_str("forth between git branches and virtual branches easily. \n\n");
173176

174177
message.push_str("If you switch to another branch, GitButler will need to be reinitialized.\n");
175178
message.push_str("If you commit on this branch, GitButler will throw it away.\n\n");
176-
message.push_str("Here are the branches that are currently applied:\n");
177-
for branch in &virtual_branches {
178-
message.push_str(" - ");
179-
message.push_str(branch.name.as_str());
180-
message.push_str(format!(" ({})", &branch.refname()?).as_str());
181-
message.push('\n');
182-
183-
if branch.head != target.sha {
184-
message.push_str(" branch head: ");
185-
message.push_str(&branch.head.to_string());
186-
message.push('\n');
187-
}
188-
for file in &branch.ownership.claims {
189-
message.push_str(" - ");
190-
message.push_str(&file.file_path.display().to_string());
179+
if !virtual_branches.is_empty() {
180+
message.push_str("Here are the branches that are currently applied:\n");
181+
for branch in &virtual_branches {
182+
message.push_str(" - ");
183+
message.push_str(branch.name.as_str());
184+
message.push_str(format!(" ({})", &branch.refname()?).as_str());
191185
message.push('\n');
186+
187+
if branch.head != target.sha {
188+
message.push_str(" branch head: ");
189+
message.push_str(&branch.head.to_string());
190+
message.push('\n');
191+
}
192+
for file in &branch.ownership.claims {
193+
message.push_str(" - ");
194+
message.push_str(&file.file_path.display().to_string());
195+
message.push('\n');
196+
}
192197
}
193198
}
194199
if let Some(prev_branch) = prev_branch {

0 commit comments

Comments
 (0)