Skip to content

fix: preserve offline repo fallbacks - #825

Merged
matt2e merged 4 commits into
mainfrom
github-inaccessible
Jun 29, 2026
Merged

fix: preserve offline repo fallbacks#825
matt2e merged 4 commits into
mainfrom
github-inaccessible

Conversation

@matt2e

@matt2e matt2e commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fall back to local clones for repo subpath validation, directory listing, and worktree fetches when GitHub is unavailable.
  • Use stale local base refs for offline worktree creation while keeping a clear error when no fallback exists.
  • Surface specific subpath validation errors in project repo forms.

Tests

  • crates-fmt
  • crates-lint
  • crates-test
  • differ-ci
  • staged-ci

matt2e added 2 commits June 25, 2026 14:16
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
@matt2e
matt2e requested review from baxen and wesbillman as code owners June 29, 2026 00:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f42929c061

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

match git::fetch_for_worktree(repo_path, repo_slug, branch_name, base_branch) {
Ok(()) => Ok(()),
Err(fetch_err) => {
if let Some(base_ref) = local_base_ref_for_worktree(repo_path, base_branch) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid reusing stale bases when the remote rejects them

When the remote is reachable but the configured base branch was deleted or renamed, git fetch origin <base> fails with couldn't find remote ref <base>. This branch treats every fetch failure as an offline case whenever a stale origin/<base> exists locally, so setup can create a new worktree from a base that the remote has already rejected instead of surfacing the bad base branch. Please gate this fallback to connectivity/auth failures, or at least exclude missing-remote-ref errors before returning Ok(()).

Useful? React with 👍 / 👎.

Comment thread apps/staged/src-tauri/src/git/github.rs Outdated
let Some(relative_path) = normalize_repo_subpath(subpath)? else {
return Ok(true);
};
Ok(clone_path.join(relative_path).is_dir())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate fallback subpaths against the Git tree

When GitHub validation fails, this checks the clone's live filesystem rather than repository contents, so offline validation accepts directories that are not valid repo subpaths, such as .git, generated/untracked folders like node_modules, or symlinks that point to directories outside the checkout. Those accepted subpaths are later stored and joined into worktree paths (for example in prs.rs), which can make sessions/PR operations fail or operate outside the intended repo. Please validate against a Git tree/ref or explicitly reject untracked, .git, and symlinked paths in the local fallback.

Useful? React with 👍 / 👎.

matt2e added 2 commits June 29, 2026 10:48
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>
@matt2e
matt2e merged commit e0ab9a5 into main Jun 29, 2026
4 checks passed
@matt2e
matt2e deleted the github-inaccessible branch June 29, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant