Skip to content

Commit aa87980

Browse files
committed
Fixing a mistake
1 parent 355d02a commit aa87980

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

crates/gitbutler-stack/src/stack.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,13 @@ impl Stack {
358358
) -> Result<StackBranch> {
359359
let state = branch_state(ctx);
360360
let repo = ctx.gix_repository()?;
361-
let commit = ctx.repo().find_commit(self.head(&repo)?)?;
361+
// If the stack is created for the first time, this will be the default target sha
362+
let head = if self.heads.is_empty() {
363+
self.head
364+
} else {
365+
self.head(&repo)?
366+
};
367+
let commit = ctx.repo().find_commit(head)?;
362368

363369
let name = Stack::next_available_name(
364370
&repo,

0 commit comments

Comments
 (0)