Repository navigation
feat(settings): new worktrees can start from a configured base branch #25942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
AyushKaithwas
wants to merge
2
commits into
pingdotgg:main
from
AyushKaithwas:feat/worktree-base-branch-setting
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
apps/mobile/src/features/settings/components/WorktreeBaseBranchSetting.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import type { ServerSettingsPatch } from "@t3tools/contracts"; | ||
| import { useEffect, useEffectEvent, useRef } from "react"; | ||
| import { View } from "react-native"; | ||
|
|
||
| import { AppText as Text, AppTextInput } from "../../../components/ui/AppText"; | ||
|
|
||
| export function WorktreeBaseBranchSetting(props: { | ||
| value: string | null; | ||
| disabled: boolean; | ||
| onChange: (patch: ServerSettingsPatch) => void; | ||
| }) { | ||
| // Save on exit too: Android Back hides the keyboard without ending editing. | ||
| const draft = useRef<{ text: string; over: string | null } | null>(null); | ||
| const save = () => { | ||
| const current = draft.current; | ||
| draft.current = null; | ||
| // Drop a draft typed over an older saved value: the updated value has already remounted the input. | ||
| if (current === null || current.over !== props.value) return; | ||
| const value = current.text.trim(); | ||
| if (props.value === null || value !== props.value) { | ||
| props.onChange({ newWorktreesBaseBranch: value }); | ||
| } | ||
| }; | ||
| const saveOnExit = useEffectEvent(save); | ||
| // oxlint-disable-next-line t3code/react-effect-budget -- leaving the screen must flush an unsaved edit | ||
| useEffect(() => () => saveOnExit(), []); | ||
| return ( | ||
| <View className="gap-2 px-4 py-3"> | ||
| <Text className="text-sm text-foreground">Base branch</Text> | ||
| <Text className="text-sm text-foreground-muted"> | ||
| The branch, tag, or commit new worktrees start from, such as dev. Leave empty to use the | ||
| repository’s default branch. | ||
| </Text> | ||
| <AppTextInput | ||
| key={props.value} | ||
| accessibilityLabel="Base branch for new worktrees" | ||
| onChangeText={(text) => { | ||
| draft.current = { text, over: props.value }; | ||
| }} | ||
| defaultValue={props.value ?? ""} | ||
| placeholder={props.value === null ? "Mixed" : "Repository default"} | ||
| editable={!props.disabled} | ||
| autoCapitalize="none" | ||
| autoCorrect={false} | ||
| className="min-h-10 rounded-xl px-3 py-2 text-base text-foreground" | ||
| onEndEditing={save} | ||
| /> | ||
| </View> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High
threads/new-task-flow-provider.tsx:696Switching to New worktree loses a manually selected branch when it matches the current checkout, so the task starts from the configured base (for example,
dev) instead of the selected branch (release). The Current checkout picker checks out the chosen branch beforeselectBranchpersists it, makingselectedBranchNameequallocalSelection.branch;resolveWorktreeSwitchBranchmistakes that equality for an automatic selection and clears it. Preserve explicit draft selections and clear only selections that follow the checkout.Also found in 1 other location(s)
apps/mobile/src/features/threads/new-task-context-presentation.ts:81🤖 Copy this AI Prompt to have your agent fix this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, comparing branch names can't tell a checked-out pick from the synced checkout branch. Fixed in 097cde0 by dropping the guess: in Current checkout the picker checks a branch out rather than choosing a worktree base, so with a base configured, switching to New worktree now always starts from that base, and the picker shows it before sending. The user can still pick
releasethere. With no base configured, the switch behaves as before.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm unable to act on this request because you do not have permissions within this repository.