Conversation
Owner
arbourd
commented
May 17, 2026
- Avoid ls-remote call when repo is already cloned
- Skip network TestClone when -short is set
- Restrict tilde expansion to ~/ in AbsolutePath
- Document --complete as an internal shell completion
- Fix misleading error when os.Stat fails in Clone
Check isGitRepository first and return early; only hit the network when a fresh clone is actually needed. Also replaces os.IsNotExist with errors.Is(err, fs.ErrNotExist) for consistency with complete.go.
Previously ~user/src was silently mangled into <current home>/user/src. Now only ~/ and ~ are expanded; ~user paths fall through to the absolute-path check and return a clear error.
There was a problem hiding this comment.
Pull request overview
This PR refines git-get path handling and clone behavior to reduce unnecessary network calls, tighten tilde expansion semantics, and make tests/documentation clearer.
Changes:
- Avoid
git ls-remote(and cloning) when the target directory is already a Git repository. - Restrict
GETPATHtilde expansion to~/~/(and platform separator equivalent), and add coverage for~otheruser/.... - Skip the network-dependent
TestClonewhengo test -shortis used, and document--completeas an internal completion protocol.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| main.go | Adds an inline note clarifying --complete is for internal shell completion integration. |
| get/get.go | Adjusts GETPATH tilde expansion rules; improves Clone preflight behavior and error handling; avoids network when already cloned. |
| get/get_test.go | Adds a tilde-user test case and skips the network clone test under -short. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.