Repository navigation
Harden GoFetch: bug fixes, new features, full Windows/macOS/Linux support - #2
Merged
Merged
Conversation
Fix a set of correctness and portability bugs and add features while keeping a single, complete, cross-platform version. Bug fixes: - destinationPath now expands ~ and returns an absolute path, so the clone target can never depend on the process working directory. - Sanitize repository names for every platform (Windows-forbidden chars, trailing dots/spaces, reserved device names like CON/COM1) and reject URLs containing spaces. - Refuse to clone into a non-empty folder and offer an explicit overwrite confirmation instead of failing with git's raw error. - History is written atomically (temp file + rename, Windows fallback) so a crash can no longer truncate history.json. - nextSuggestion used a value receiver and never advanced: tab completion now really cycles through recent folders. - Typing "q" while entering a URL or path no longer quits the app. - Cross-platform home expansion also understands "~\" on Windows. - Friendlier, actionable clone errors (not found, auth, DNS, network). New: - Self-hosted / generic Git hosts accepted alongside GitHub and GitLab. - ssh:// URLs, www. stripping and trailing-slash handling. - Cancellable clones (Esc) that clean up the partial directory. - History search (/, ctrl+l), entry removal (ctrl+d), relative timestamps. - ctrl+o opens the selected folder, ctrl+y copies its path. - Tab completion for the destination directory. - Broader build detection: Maven, Gradle, Make, Python, and npm/yarn/pnpm. - --no-build flag for untrusted repositories. - install.ps1 for Windows; install.sh now installs a stable "gofetch" name and supports bash/zsh/fish. - GitHub Actions CI across Linux, macOS and Windows plus cross-compile. - Much larger test suite, including a real end-to-end git clone. Version bumped to 0.4.0. README rewritten to document all of it. Co-authored-by: openhands <openhands@all-hands.dev>
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.
What this does
This PR fixes the bugs found in the current code and turns GoFetch into one complete, cross-platform version that works the same on Windows, macOS and Linux.
Bug fixes
destinationPathnow expands~and returns an absolute path, sogit clonealways writes where the UI says it will.\ / : * ? " < > |), trailing dots/spaces and reserved device names (CON,COM1, …). URLs containing spaces are rejected early.history.jsonis now written atomically (temp file + rename, with a Windows fallback) instead of a direct overwrite.nextSuggestionused a value receiver, so the suggestion index was reset on every call. Fixed with a pointer receiver.qwhile typing quit the app. Typingqin the URL or path field no longer quits; quit is nowCtrl+C/qonly where it is not a text field.~\.New features
ssh://URLs,www.stripping and trailing-slash handling.Esc) that clean up the partial directory./orCtrl+L), entry removal (Ctrl+D) and relative timestamps.Ctrl+Oopens the selected folder,Ctrl+Ycopies its path.Tabcycles through recent destination folders.--no-buildflag for untrusted repositories.install.ps1for Windows;install.shnow installs a stablegofetchname and supports bash, zsh and fish.Verification
gofmtclean,go vet ./...clean.go test -race -count=1 ./...passes (URL parsing, sanitization, history persistence, build detection, the TUI state machine, and a real end-to-endgit clone).windows/amd64,darwin/amd64,darwin/arm64,linux/amd64,linux/arm64,linux/386.install.shwas executed end-to-end and produced a workinggofetch 0.4.0.Version bumped to
0.4.0; README rewritten to document everything.@ciao22king can click here to continue refining the PR