Skip to content

Land on any git remote, with GitHub and GitLab as forges - #14

Merged
lydakis merged 9 commits into
mainfrom
claude/project-thread-wdmsae
Oct 27, 2026
Merged

lydakis merged 9 commits into
mainfrom
claude/project-thread-wdmsae

Conversation

@lydakis

@lydakis lydakis commented Oct 27, 2026

Copy link
Copy Markdown
Owner

What changes

gft land no longer needs GitHub's API, a GitHub token, or gh to commit. It builds one commit from the copy's files with git's plumbing, using a separate index so the copy's own index and HEAD stay untouched. It then pushes that commit to graft/NAME with --force-with-lease. Any remote that git can push to works, with the credentials git already has.

Review requests now come from a small forge layer (src/forge.rs). It replaces src/github.rs.

  • GitHub and GitHub Enterprise: pull requests.
  • GitLab and self-managed GitLab: merge requests. Drafts use the Draft: title prefix. Merge detection uses merge_commit_sha, then squash_commit_sha, then sha.
  • github.com and gitlab.com are recognized by host. For other servers, gft get URL --forge github|gitlab[:PROJECT] names the forge. --forge none lands branches only.
  • No forge: land prints the branch and any links the server sends back. sync treats a landing as merged once every file the landing touched is the same on the default branch. rm --delete-branch deletes the branch through git, with a lease.
  • Tokens: read from GITHUB_TOKEN/GH_TOKEN or GITLAB_TOKEN. Otherwise Graft asks gh auth token or glab config get token if they are installed.
    • The token is also offered to git push through a one-off credential helper that reads it from the environment.
    • land stops before pushing when a forge has no token.

src/remote.rs handles remote branches (ls-remote), pushing and deleting with leases, and building the commit. Parents missing from the shallow, partial .git are fetched with --depth=1 --filter=blob:none. Presence is checked with rev-list --missing=print, because cat-file triggered a 50 s lazy fetch.

Projects saved before this change are read as GitHub repositories (remote and forge are filled in on load).

Benchmark (GitHub, from a cloud machine, 6 files changed)

step time
read the remote's graft/* branches 0.4 s
build the commit locally ~0.2 s (VS Code tree: 0.17–0.22 s)
git push 1.7 s
whole gft land 2.2–2.8 s

I couldn't time the old API landing here: this environment's proxy refuses GitHub API writes. That path made 4 sequential write calls (ref, tree, commit, ref update), plus one per non-text file. Read calls here took 0.14–0.34 s each, so the two paths are in the same range. The push now does in one step what used to take one API call per file.

Tests

  • tests/workflow.rs: now pushes to a local file:// upstream. The fake GitHub serves only pulls and compare.
    • Cut-short pushes are simulated with an update hook.
  • New end-to-end test: a --forge none project (landing, "nothing new to land", detecting a squash merge by content, rm --delete-branch with and without a moved branch). It also covers a gitlab:o/n project (draft merge request, description update, merged and landing again as a new merge request on top of the merge).
  • Unit tests: forge parsing, remote hosts, and forwarding remote: lines.
  • Results: 20 unit tests and 11 workflow tests pass on a real mount (GRAFT_REQUIRE_MOUNT=1). fmt and clippy (-D warnings) are clean.

Docs

The README now covers any git remote, --forge, tokens, and a new "Remotes and forges" section. The worktree comparison has the measured landing time.


Generated by Claude Code

…d, renames, folder 3-way merge, home copy fixes

- gft up remounts copies after a restart; commands remount the copy they work on
- ls checks copies in parallel, drops same-bytes overlaps, flags unmounted copies; --json on ls, status, changes
- gft diff [A [B]]; changes/diff between copies on different commits
- sync merges into upstream's new name for renamed files, sets aside local git commits, works in the home copy
- plain folders merge three ways on sync; land's refusal points at sync
- the home copy shows its own changes in status; new --from HOME copies them
- land puts text files inline in the tree, in batches, instead of a blob call each
- a second get of a same-named repository uses OWNER-NAME workspaces; get names where an existing project is
- rm --delete-branch; drop takes the home folder name
- README: the pitch, when plain git is better, history on demand with git fetch --deepen

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq
`gft land` no longer needs GitHub's API to commit: it builds one commit
from the copy's files with git's plumbing (a separate index, so the
copy's own is untouched) and pushes it to graft/NAME with a lease, so
any remote git can push to works, with the credentials git already has.

Review requests come from a small forge layer: pull requests on GitHub
and GitHub Enterprise, merge requests on GitLab and self-managed GitLab.
github.com and gitlab.com are known by host; `gft get URL --forge
github|gitlab[:PROJECT]` names one for a server of your own, and
`--forge none` lands branches alone. Without a forge, sync counts a
branch as merged once the default branch has every file as the landing
left it. Tokens come from GITHUB_TOKEN/GH_TOKEN or GITLAB_TOKEN, else
from gh or glab if installed, and are offered to git push too.

Projects saved before this are read as GitHub repositories.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T01:47:08.633116Z a18ccff New commits
🔒 Security Review ✅ Completed 2026-10-27T01:52:20.221102Z a18ccff New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: b9cf21d87c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/remote.rs Resolved
Comment thread src/land.rs Resolved
Comment thread src/forge.rs Resolved
…uote, skip GitLab forks

- new --on keeps the landing's fingerprints: with no forge they are how sync
  tells the landing underneath was merged.
- Paths starting with a double quote (or holding a line break) go to
  hash-object --stdin-paths C-quoted, so git hashes the file named.
- GitLab merge requests from forks with a branch of the same name are not
  the copy's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CboUL9BU7nvDEZKfQBSkkq

lydakis commented Oct 27, 2026

Copy link
Copy Markdown
Owner Author

@codex review


Generated by Claude Code

@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: 732dad3f33

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/land.rs Resolved
Comment thread src/forge.rs Resolved

@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: f01c3822cd

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/remote.rs Resolved
Comment thread src/state.rs Resolved
@lydakis
lydakis merged commit 14ed872 into main Oct 27, 2026
8 checks passed
@lydakis lydakis mentioned this pull request Oct 27, 2026
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.

2 participants