You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to assign a file that is locked by hunks on other
commits, the code previously printed a debug-style rejection list and
then misleadingly reported success.
Instead, fail fast with a user-friendly error that explains the file is
locked to other commit(s) and suggests using git to modify commits or
move the changes. This prevents confusing output and makes the failure
reason clear.
Copy file name to clipboardExpand all lines: crates/but/src/rub/assign.rs
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,6 @@ use but_workspace::StackId;
3
3
use colored::Colorize;
4
4
use gitbutler_command_context::CommandContext;
5
5
6
-
usecrate::command;
7
-
8
6
pub(crate)fnassign_file_to_branch(
9
7
ctx:&mutCommandContext,
10
8
path:&str,
@@ -79,7 +77,12 @@ fn do_assignments(
79
77
) -> anyhow::Result<()>{
80
78
let rejections = but_hunk_assignment::assign(ctx, reqs,None)?;
81
79
if !rejections.is_empty(){
82
-
command::print(&rejections,false)?;
80
+
// Don't print the debug output, instead provide a clear error
81
+
anyhow::bail!(
82
+
"Cannot assign file - it is locked to {} commit{}. Files are locked when they have changes in commits that conflict with the requested assignment. Use git commands to modify commits or move the changes.",
0 commit comments