Skip to content

Commit 12b358b

Browse files
authored
Merge pull request #47 from mcintyre94/pull-before-creating-branch-28c3a073
Pull main before creating worktree
2 parents a7147c6 + ac3303c commit 12b358b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Wisp/ViewModels/ChatViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,9 +1328,9 @@ final class ChatViewModel {
13281328
let worktreeParent = "/home/sprite/.wisp/worktrees/\(repoName)"
13291329
let worktreeDir = "\(worktreeParent)/\(uniqueBranchName)"
13301330

1331-
let command = "mkdir -p '\(worktreeParent)' && if git -C '\(currentWorkDir)' worktree add '\(worktreeDir)' -b '\(uniqueBranchName)' 2>/dev/null; then echo '\(worktreeDir)'; fi"
1331+
let command = "git -C '\(currentWorkDir)' pull 2>/dev/null || true; mkdir -p '\(worktreeParent)' && if git -C '\(currentWorkDir)' worktree add '\(worktreeDir)' -b '\(uniqueBranchName)' 2>/dev/null; then echo '\(worktreeDir)'; fi"
13321332

1333-
let (output, _) = await apiClient.runExec(spriteName: spriteName, command: command, timeout: 30)
1333+
let (output, _) = await apiClient.runExec(spriteName: spriteName, command: command, timeout: 60)
13341334
// git worktree add may print "HEAD is now at..." to stdout before our echo,
13351335
// so take only the last non-empty line which is always the echo'd path.
13361336
let path = output

0 commit comments

Comments
 (0)