Let the git remote be set from Settings
Attaching a workspace to an existing repository meant leaving for a terminal: gitsync could init, commit and push, and could tell whether an 'origin' existed, but had no way to create one, and nothing in the settings held a remote URL. Sync just logged "no 'origin' remote configured" and committed locally. Settings > Git remote... now shows the workspace repository's origin and lets it be set, repointed or cleared. The URL is read from and written to the repository, never to config.json, because a remote belongs to the checkout — so each workspace shows its own, and the box is refreshed whenever the repository in play changes. This is separate from the Gitea publishing in New project, which is a cookiecutter post-gen hook and only ever applies to generated projects. Also factors out first_output_line, which repo_root and the new origin_url were both open-coding, and origin_args, so the add-vs-set-url decision can be tested without a repository on disk. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GBWj9TphFMCoh7VHaSRnvQ
This commit is contained in:
@@ -203,6 +203,12 @@ pub struct App {
|
||||
rename_focus: bool,
|
||||
/// Whether the delete confirmation opened from that menu is up.
|
||||
confirm_delete: bool,
|
||||
/// Editable copy of the workspace repository's `origin` URL. Read back from
|
||||
/// git whenever the repository changes, never persisted to the config —
|
||||
/// the remote belongs to the checkout, not to the app.
|
||||
remote_input: String,
|
||||
/// Whether the git-remote dialog is up.
|
||||
show_git_remote: bool,
|
||||
status: String,
|
||||
show_log: bool,
|
||||
git_log: String,
|
||||
@@ -371,6 +377,8 @@ impl App {
|
||||
show_rename: false,
|
||||
rename_focus: false,
|
||||
confirm_delete: false,
|
||||
remote_input: String::new(),
|
||||
show_git_remote: false,
|
||||
status: String::new(),
|
||||
show_log: false,
|
||||
git_log: String::new(),
|
||||
@@ -534,6 +542,10 @@ impl eframe::App for App {
|
||||
self.confirm_delete_window(ctx);
|
||||
}
|
||||
|
||||
if self.show_git_remote {
|
||||
self.git_remote_window(ctx);
|
||||
}
|
||||
|
||||
if self.show_new_project {
|
||||
self.new_project_window(ctx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user