diff options
author | Ryooooooga <ryoga_314@yahoo.co.jp> | 2021-03-02 12:15:25 +0900 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-03-13 11:02:31 +1100 |
commit | 64daf1310d63bb5c6334ce0cd06287869bac3218 (patch) | |
tree | 31ea7b5957337f294313c591bfab128dd692d6b3 /pkg/commands/oscommands | |
parent | e5ba0d9d9c3e29de9a4219a4037e477aa1a77581 (diff) |
Fix staging/unstaging files containing `"` in paths
Diffstat (limited to 'pkg/commands/oscommands')
-rw-r--r-- | pkg/commands/oscommands/os.go | 6 | ||||
-rw-r--r-- | pkg/commands/oscommands/os_test.go | 11 |
2 files changed, 0 insertions, 17 deletions
diff --git a/pkg/commands/oscommands/os.go b/pkg/commands/oscommands/os.go index cc66f2cab..809f9deab 100644 --- a/pkg/commands/oscommands/os.go +++ b/pkg/commands/oscommands/os.go @@ -256,12 +256,6 @@ func (c *OSCommand) Quote(message string) string { return escapedQuote + message + escapedQuote } -// Unquote removes wrapping quotations marks if they are present -// this is needed for removing quotes from staged filenames with spaces -func (c *OSCommand) Unquote(message string) string { - return strings.Replace(message, `"`, "", -1) -} - // AppendLineToFile adds a new line in file func (c *OSCommand) AppendLineToFile(filename, line string) error { f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) diff --git a/pkg/commands/oscommands/os_test.go b/pkg/commands/oscommands/os_test.go index e6f3bd33d..5be52683e 100644 --- a/pkg/commands/oscommands/os_test.go +++ b/pkg/commands/oscommands/os_test.go @@ -162,17 +162,6 @@ func TestOSCommandQuoteWindows(t *testing.T) { assert.EqualValues(t, expected, actual) } -// TestOSCommandUnquote is a function. -func TestOSCommandUnquote(t *testing.T) { - osCommand := NewDummyOSCommand() - - actual := osCommand.Unquote(`hello "test"`) - - expected := "hello test" - - assert.EqualValues(t, expected, actual) -} - // TestOSCommandFileType is a function. func TestOSCommandFileType(t *testing.T) { type scenario struct { |