diff --git a/CHANGELOG.md b/CHANGELOG.md index 955e2fe..5703ff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,9 @@ This project tries to adhere to [Semantic Versioning](http://semver.org/). work tree status. This adds a bit if parsing complexity, but should be the absolute most robust long term way to read things, and should enhance cross platform support in the future. -- TODO: Use `TAB` as IFS character for file-list instead of `|`. This should - still be understandable by most shells but significantly less likely to appear - in a filename. +- Use `TAB` as IFS character for file-list instead of `|`. This should still be + understandable by most shells but significantly less likely to appear in a + filename. ## 0.0.1 - 2014-03-04 First "ready for daily usage" internal alpha version. diff --git a/commands/inits/data/status_shortcuts.sh b/commands/inits/data/status_shortcuts.sh index 5c7d2d3..d22f6e9 100644 --- a/commands/inits/data/status_shortcuts.sh +++ b/commands/inits/data/status_shortcuts.sh @@ -21,7 +21,7 @@ scmpuff_status() { # Export numbered env variables for each file scmpuff_clear_vars - IFS="|" + IFS=$'\t' local e=1 for file in $files; do export $scmpuff_env_char$e="$file" diff --git a/commands/status/statuslist.go b/commands/status/statuslist.go index f73f92f..e45989c 100644 --- a/commands/status/statuslist.go +++ b/commands/status/statuslist.go @@ -141,17 +141,17 @@ func (sl StatusList) printStatus(includeParseData, includeStatusOutput bool) { b.Flush() } -// - machine readable string for env var parsing of file list -// - same format that smb_breeze uses (but without preceding @@FILES thing that -// creates extra shell parsing mess) -// - needs to be returned in same order that file lists are outputted to screen, -// otherwise env vars won't match UI. +// Machine readable string for environment variable parsing of file list in +// the scmpuff_status() shell script. +// +// Needs to be returned in same order that file lists are outputted to screen, +// otherwise env vars won't match UI. func (sl StatusList) dataForParsing() string { items := make([]string, sl.numItems()) for i, si := range sl.orderedItems() { items[i] = si.fileAbsPath } - return strings.Join(items, "|") + return strings.Join(items, "\t") } // Returns the banner string to be used for printing. diff --git a/features/command_expand.feature b/features/command_expand.feature index 9832eb6..47d2df3 100644 --- a/features/command_expand.feature +++ b/features/command_expand.feature @@ -53,10 +53,6 @@ Feature: command expansion at command line | hi mom.txt | hi\ mom.txt | | "x.txt | \"x.txt | - @wip - Scenario: Don't get screwed up if filename contains a | symbol - Given PENDING - Scenario: Allow user to specify --relative paths Given a directory named "foo" And a directory named "foo/bar" diff --git a/features/shell_functions.feature b/features/shell_functions.feature index ce3a841..fb71e8f 100644 --- a/features/shell_functions.feature +++ b/features/shell_functions.feature @@ -61,6 +61,25 @@ Feature: scmpuff_status function | bash | | zsh | + Scenario Outline: Sets proper environment variables in shell with weird filenames + Given I am in a git repository + And an empty file named "aa bb" + And an empty file named "bb|cc" + And an empty file named "cc*dd" + When I run `` interactively + And I type `eval "$(scmpuff init -s)"` + And I type "scmpuff_status" + And I type `echo -e "e1:$e1\ne2:$e2\ne3:$e3\ne4:$e4\n"` + And I type "exit" + Then the output should match /^e1:.*aa bb$/ + And the output should match /^e2:.*bb\|cc$/ + And the output should match /^e3:.*cc\*dd$/ + And the output should match /^e4:$/ + Examples: + | shell | + | bash | + | zsh | + Scenario Outline: Clears extra environment variables from before Given I am in a complex working tree status matching scm_breeze tests And the scmpuff environment variables have been cleared