Support non-ASCII branch names during workspace cloning

Summary

When creating a workspace from a branch containing non-ASCII characters (e.g. feature/günter-überarbeitung), git cloning failed with exit code 128 because Ruby's Shellwords.shellescape prepended backslashes to non-ASCII bytes (e.g. feature/g\ünter-\überarbeitung).

Root Cause

Ruby's standard library Shellwords.shellescape treats all non-ASCII characters as shell metacharacters and inserts backslashes (str.gsub!(/([^A-Za-z0-9_\-.,:+\/@\n])/, "\\\\1")). When interpolated into INTERNAL_POSTSTART_COMMAND_CLONE_PROJECT_SCRIPT, git clone receives feature/g\ünter-\überarbeitung instead of feature/günter-überarbeitung and fails to locate the remote ref.

Fix

Use a dedicated shellescape_ref method that escapes shell metacharacters ($, ;, &, |, ", ', \, spaces, redirect operators) to prevent command injection while preserving valid UTF-8 non-ASCII characters ([:^ascii:]).

Closes #596326

Changelog: fixed EE: true

Merge request reports

Loading
Loading