Skip to content

fix: quote git push tag suggestions#502

Merged
shcheklein merged 1 commit into
iterative:mainfrom
w3lld1:fix/114-quote-push-suggestions
Jul 9, 2026
Merged

fix: quote git push tag suggestions#502
shcheklein merged 1 commit into
iterative:mainfrom
w3lld1:fix/114-quote-push-suggestions

Conversation

@w3lld1

@w3lld1 w3lld1 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #114 by shell-quoting tag names in the git push suggestions printed after creating/deleting GTO tags.

Changes

  • Use shlex.quote() when rendering the suggested tag argument.
  • Preserve unquoted suggestions for shell-safe tag names such as a1@v0.0.1.
  • Quote tags containing shell-significant characters like # and !, e.g. git push origin 'nn1#prod#1'.
  • Update CLI regression expectations for register/assign suggestions.

Verification

  • pytest tests/test_cli.py::test_register tests/test_cli.py::test_assign -q
  • pytest -q
    • 188 passed, 1 warning
  • python -m py_compile gto/*.py
  • git diff --check

Copilot AI 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.

Pull request overview

This PR addresses issue #114 by making the CLI’s “git push …” follow-up suggestions safe to copy/paste in shells when GTO-generated tag names contain shell-significant characters (e.g., #, !), by applying POSIX-style shell quoting.

Changes:

  • Use shlex.quote() when rendering the tag argument in the “To push the changes upstream…” suggestion output.
  • Update CLI regression tests to expect quoted suggestions for tags containing shell-significant characters.
  • Preserve unquoted output for already shell-safe tag names (since shlex.quote() leaves safe strings unchanged).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
gto/registry.py Quotes tag names in the printed git push suggestions via shlex.quote() to avoid shell parsing issues.
tests/test_cli.py Updates expected CLI output strings to match the newly quoted git push suggestions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@shcheklein
shcheklein merged commit 6108e79 into iterative:main Jul 9, 2026
16 checks passed
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.

Escaping required for promotion tags

4 participants