Skip to content

Commit

Permalink
Merge pull request #44 from jdelStrother/glob-escape
Browse files Browse the repository at this point in the history
scmpuff expand should escape '*'
  • Loading branch information
mroth authored May 23, 2019
2 parents 8dce47e + 13bd44f commit 5688434
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ install:
- bash --version
- git --version
# TODO: install ruby dependencies for integration testing
- gem install bundler --quiet --no-ri --no-rdoc
- gem install bundler --quiet --no-document
- bundle install --jobs 4 --retry 3 --path vendor/bundle
- bundle exec cucumber --version

Expand Down
2 changes: 1 addition & 1 deletion commands/expand/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Takes a list of digits (1 4 5) or numeric ranges (1-5) or even both.`,

var expandArgDigitMatcher = regexp.MustCompile("^[0-9]{0,4}$")
var expandArgRangeMatcher = regexp.MustCompile("^([0-9]+)-([0-9]+)$")
var shellEscaper = regexp.MustCompile("([\\^()\\[\\]<>' \";\\|])")
var shellEscaper = regexp.MustCompile("([\\^()\\[\\]<>' \";\\|*])")

// Process expands args and performs all substitution, etc.
//
Expand Down
4 changes: 4 additions & 0 deletions features/command_expand.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Feature: command expansion at command line
When I successfully run `scmpuff expand -- git xxx "foo bar" 1`
Then the output should match /git\txxx\tfoo\\ bar\ta.txt/

Scenario: Make sure args with globs get escaped on way back
When I successfully run `scmpuff expand -- git xxx --exclude='refs/wip/*' 1`
Then the output should contain "git xxx --exclude=refs/wip/\* a.txt"

Scenario Outline: Verify filenames with stupid characters are properly escaped
Given I override the environment variables to:
| variable | value |
Expand Down

0 comments on commit 5688434

Please sign in to comment.