Skip to content

Fix Open in Terminal running commands found in the repository path - #759

Merged
hannesa2 merged 1 commit into
masterfrom
fix-terminal-path-quoting
Oct 5, 2026
Merged

hannesa2 merged 1 commit into
masterfrom
fix-terminal-path-quoting

Conversation

@goneng

@goneng goneng commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Pass the repository path to the shell as literal text when opening it in
Terminal or iTerm2, so a folder name holding shell syntax is entered
rather than evaluated.

  • Single-quote the directory in the line GitX sends to the terminal,
    escaping embedded single quotes; double quotes still expanded $(...)
    and backticks
  • Applies to both Terminal and iTerm2, which share the same line
  • Ported from hbmartin/gitx@7305c7db (the quoting part only)

Test plan:

  • PBTerminalHandlerPreferenceTests checks the quoted line, and runs it
    through /bin/sh in a directory named with $(...), backticks and
    quotes; it fails before the change and passes after
  • Full GitXTests suite passes (317 tests)
  • Repository > Open in Terminal, Debug build, with both Terminal and
    iTerm2: on an ordinary repository it opens there and runs
    git status; on one whose folder name contains $(...), backticks
    and a quote, the shell enters that folder as named and nothing in the
    name is executed

Pass the repository path to the shell as literal text, so a folder
name holding shell syntax is entered rather than evaluated.

- Single-quote the directory in the line sent to Terminal and iTerm2,
  escaping embedded single quotes; double quotes still expanded $(...)
  and backticks
- Test that the line quotes such a path, and that /bin/sh running it
  ends up in a directory named with $(...), backticks and quotes

Ported from hbmartin/gitx@7305c7db (the quoting only).
@goneng
goneng marked this pull request as ready for review October 5, 2026 03:37
@goneng goneng added the bugfix label Oct 5, 2026
@goneng
goneng requested a review from hannesa2 October 5, 2026 03:38
@hannesa2
hannesa2 merged commit ed460ae into master Oct 5, 2026
3 checks passed
@hannesa2
hannesa2 deleted the fix-terminal-path-quoting branch October 5, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants