diff options
author | Teddy Wing | 2018-04-19 23:44:13 +0200 |
---|---|---|
committer | Teddy Wing | 2018-04-19 23:44:13 +0200 |
commit | 3f6e62684b1fb1167435c6fa4f6c6f02aaff3937 (patch) | |
tree | f928f9fbf3cb33032477e468f3510f2f5506a170 /t/104-drop-works-with-branch-names-with-slashes.t | |
parent | d1617e2f29d1a8080602b60cd83ffddb01e88875 (diff) | |
download | git-branch-list-3f6e62684b1fb1167435c6fa4f6c6f02aaff3937.tar.bz2 |
git-branch-list(drop): Fix deletion for branches with slashes
Previously, if a branch name had slashes in it, the `drop` command would
fail. This is because it used `sed` with `/` separators, and the
unescaped slashes in the branch name would mess up sed's pattern.
Change this to use grep instead of sed so we don't have to worry about
escaping and special characters in branch names.
Diffstat (limited to 't/104-drop-works-with-branch-names-with-slashes.t')
-rw-r--r-- | t/104-drop-works-with-branch-names-with-slashes.t | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/t/104-drop-works-with-branch-names-with-slashes.t b/t/104-drop-works-with-branch-names-with-slashes.t new file mode 100644 index 0000000..8219e3e --- /dev/null +++ b/t/104-drop-works-with-branch-names-with-slashes.t @@ -0,0 +1,29 @@ +#!/usr/bin/env perl -w + +use strict; + +use Test::More; + +use Bin qw($BIN); + +chdir 't-git-repo' or die $!; + +system('git checkout -b feature/with-slashes'); +ok !$?; + +system("$BIN save"); +ok !$?; + +system("$BIN drop"); +ok !$?; + +my $branch_list = qx($BIN); +is $branch_list, ''; + + +# Teardown +system('git checkout master'); +system('git branch -d feature/with-slashes'); + + +done_testing; |