forked from git-l10n/git-po
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn: factor out _collapse_dotdot function
The SVN API functions will not accept ../foo but their canonicalization functions will not collapse it. So we'll have to do it ourselves. _collapse_dotdot() works better than the existing regex did. This will be used shortly when canonicalize_path() starts using the SVN API. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More 'no_plan'; | ||
|
||
use Git::SVN::Utils; | ||
my $collapse_dotdot = \&Git::SVN::Utils::_collapse_dotdot; | ||
|
||
my %tests = ( | ||
"foo/bar/baz" => "foo/bar/baz", | ||
".." => "..", | ||
"foo/.." => "", | ||
"/foo/bar/../../baz" => "/baz", | ||
"deeply/.././deeply/nested" => "./deeply/nested", | ||
); | ||
|
||
for my $arg (keys %tests) { | ||
my $want = $tests{$arg}; | ||
|
||
is $collapse_dotdot->($arg), $want, "_collapse_dotdot('$arg') => $want"; | ||
} |