mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
fix bug in GlobUtil
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
package sonia.scm.util;
|
||||
|
||||
/**
|
||||
* Util for pattern matching with glob
|
||||
* Util for pattern matching with glob
|
||||
* (http://en.wikipedia.org/wiki/Glob_%28programming%29) syntax.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -190,6 +190,6 @@ public class GlobUtil
|
||||
*/
|
||||
public static boolean matches(String glob, String value)
|
||||
{
|
||||
return value.matches(convertGlobToRegEx(value));
|
||||
return value.matches(convertGlobToRegEx(glob));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,11 +66,11 @@ public class GlobUtilTest
|
||||
@Test
|
||||
public void matchesTest()
|
||||
{
|
||||
assertTrue(GlobUtil.matches("/test/path/somefile.txt", "/test/path/*"));
|
||||
assertTrue(GlobUtil.matches("/test/path/somefile.txt", "*/somefile.txt"));
|
||||
assertTrue(GlobUtil.matches("asd", "a*d"));
|
||||
assertTrue(GlobUtil.matches("asd", "a?d"));
|
||||
assertFalse(GlobUtil.matches("asd", "a\\*d"));
|
||||
assertFalse(GlobUtil.matches("asd", "a\\?d"));
|
||||
assertTrue(GlobUtil.matches("/test/path/*", "/test/path/somefile.txt"));
|
||||
assertTrue(GlobUtil.matches("*/somefile.txt", "/test/path/somefile.txt"));
|
||||
assertTrue(GlobUtil.matches("a*d", "asd"));
|
||||
assertTrue(GlobUtil.matches("a?d", "asd"));
|
||||
assertFalse(GlobUtil.matches("a\\*d", "asd"));
|
||||
assertFalse(GlobUtil.matches("a\\?d", "asd"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user