fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Peter AmmonClean up "strip control characters" changes17fdd2f15

master
887 B36 linesraw
1#RUN: %fish %s
2#REQUIRES: command -v git
3
4# Verify VCS prompts strip control characters from
5# state files before showing them (same class as prompt_pwd / #12629).
6
7set -l tmp (mktemp -d)
8
9# --- fish_hg_prompt ---
10# Stub `hg` to satisfy `command -sq hg` without requiring real Mercurial.
11mkdir $tmp/bin
12echo '#!/bin/sh' >$tmp/bin/hg
13chmod +x $tmp/bin/hg
14set -gx PATH $tmp/bin $PATH
15
16mkdir -p $tmp/hgrepo/.hg
17touch $tmp/hgrepo/.hg/dirstate
18printf 'main\e]0;OHNO\a\x7f' >$tmp/hgrepo/.hg/branch
19
20cd $tmp/hgrepo
21fish_hg_prompt
22echo
23# CHECK: {{.*}} (main]0;OHNO)
24
25# --- fish_git_prompt: rebase-merge state with escape sequence in head-name ---
26mkdir $tmp/gitrepo
27cd $tmp/gitrepo
28git init -q
29mkdir .git/rebase-merge
30printf 'refs/heads/main\e]0;OHNO\a\x7f' >.git/rebase-merge/head-name
31: >.git/rebase-merge/msgnum
32: >.git/rebase-merge/end
33
34fish_git_prompt
35echo
36# CHECK:  (main]0;OHNO|REBASE-m)