Skip to content

Improve path expansion, tests#34

Merged
arbourd merged 5 commits into
mainfrom
cleanup
May 17, 2026
Merged

Improve path expansion, tests#34
arbourd merged 5 commits into
mainfrom
cleanup

Conversation

@arbourd
Copy link
Copy Markdown
Owner

@arbourd 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

arbourd added 5 commits May 9, 2026 08:11
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.
@arbourd arbourd merged commit da99c82 into main May 17, 2026
7 of 8 checks passed
@arbourd arbourd deleted the cleanup branch May 17, 2026 12:24
@arbourd arbourd requested a review from Copilot May 17, 2026 13:53
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 GETPATH tilde expansion to ~ / ~/ (and platform separator equivalent), and add coverage for ~otheruser/....
  • Skip the network-dependent TestClone when go test -short is used, and document --complete as 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.

Comment thread get/get.go
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