Repository navigation
Upload only files git doesn't ignore on devpod up of a local folder - #29
Merged
Merged
Conversation
Streaming a local folder into a remote machine or a Kubernetes pod uploaded everything not excluded by .devpodignore, including .git, node_modules, build output and nested git worktrees, which made uploads huge (8.8 GB instead of 120 MB on a checkout of this repository). When the folder is in a git work tree, the tunnel server now only uploads the files `git ls-files --cached --others --exclude-standard` lists, including the files of checked out submodules but not nested repositories or worktrees. .devpodignore takes precedence: its patterns leave out listed files and its negation patterns upload files git ignores. When the folder is the top of the work tree, the repository's .git is replaced by a shallow one with the checked out commit, the branch, its upstream branch (deep enough for ahead/behind counts), the remotes and the repository's user config, so that the workspace can commit and push. `!.git` in .devpodignore uploads the whole .git and `.git` uploads none. Without git, or outside a git work tree, nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re-filtering-df3747 # Conflicts: # CHANGELOG.md
DevPod now gives a workspace the git identity of its repository, or the one given with --git-user-name and --git-user-email, in the container's global git config. A user copied into the snapshot's local config would override it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Match git's file names with those on disk in Unicode normalization form C, and ignoring case when git does (core.ignorecase), and archive listed files with git's spelling. On macOS, files with decomposed names or renamed only in case were left out, and showed as deleted. - Mark tracked files that .devpodignore leaves out skip-worktree in the shallow .git, so they don't show as deleted and get committed as such. - Give each checked out submodule a shallow .git of its own, and copy the submodule config, so submodules stay repositories in the workspace. Overlays now replace folders at any path. - Fetch HEAD and its upstream branch in one shallow fetch, as a second one cut the history of the first and miscounted commits ahead. - Create the shallow .git with the ref format of the repository, not the user's init.defaultRefFormat, which older git can't read. - Copy only the settings of the checked out branch, not of branches whose name starts with it, and keep boolean settings without a value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
devpod up <folder>streamed the whole folder (minus.devpodignore) into a remote machine or Kubernetes pod, including.git,node_modules, build output and nested git worktrees. On a checkout of this repository that was 8.8 GB; it is now 120 MB (35 s → 2.6 s to build the tar).When the workspace folder is in a git work tree:
git ls-files --cached --others --exclude-standardlists is uploaded: tracked files and untracked files no.gitignore,.git/info/excludeorcore.excludesFileignores. Files of checked out submodules are included; nested repositories and worktrees are not. Folders git ignores are never read. Names are matched in Unicode NFC (and case-insensitively whencore.ignorecaseis set), and listed files are archived with git's spelling, so macOS decomposed names and case-only renames match the index..devpodignoretakes precedence (like ripgrep's.ignoreover.gitignore): its patterns leave out listed files, and its negation patterns upload files git ignores (e.g.!.env). It keeps its.dockerignoresyntax..git: at the top of the work tree, the repository's.gitis replaced by a shallow one built withgit fetch --depthfrom the local repository: the checked out commit, the branch, its upstream branch (fetched deep enough to reach the merge base, so ahead/behind counts are right), the remotes andinfo/exclude. It has nouser.*config, so it doesn't override the identity Give a workspace the git identity of its repository #28 puts in the container's global config. Enough to commit and push from the workspace; staged changes show as unstaged. Each checked out submodule gets its own shallow.git(embedded in its folder), and the submodule config is copied. Tracked files.devpodignoreleaves out are marked skip-worktree, so they don't show as deleted (their blobs are still in.git). The snapshot uses the local repository's object and ref formats, not the user'sinit.*defaults. This also fixes uploads from a git worktree, whose.gitfile pointed at a path missing in the container.!.gitin.devpodignoreuploads the whole.git,.gituploads none.Changes
pkg/extract:ExcludeRules(tri-state verdict: unmatched / excluded / re-included),FileList, andTarOptions.Files/TarOptions.Overlays(folders replaced at any path).pkg/git/worktree.go:ListFiles,IsTopLevel,IgnoresCase,Snapshot.go.mod:golang.org/x/text(already vendored) is now a direct dependency.pkg/agent/tunnelserver:workspaceTarOptionsused byStreamWorkspaceandStreamMountof the workspace mount.Testing
git statusis clean.go test ./pkg/... ./cmd/...,go vet, golangci-lint v1.60.1: pass.devpod upagainst a remote machine or Kubernetes cluster.🤖 Generated with Claude Code