protected static Glob parseGlobPattern( File relativeTo, String glob, Glob next ) {
		boolean negate;
		if( glob.startsWith("!") ) {
			negate = true;
			glob = glob.substring(1);
		} else {
			negate = false;
		}
		
		String regex;
		if( glob.startsWith("/") ) {
			assert relativeTo != null;
			regex = "^"+Pattern.quote(path(relativeTo)+"/");
			glob = glob.substring(1);
		} else {
			regex = "(?:^|.*/)";
		}
		
		// Based on the * and ** rules used by .gitignore:
		//	https://git-scm.com/docs/gitignore
		
		if( glob.startsWith("**/") ) glob = glob.substring(3);
		
		Matcher starMatcher = ASTERSTICKS.matcher(glob);
		
		int i = 0;
		while( starMatcher.find() ) {
			regex += Pattern.quote(glob.substring(i,starMatcher.start()));
			if( "/**/".equals(starMatcher.group()) ) {
				regex += "(?:.*/)*";
			} else if( "**".equals(starMatcher.group()) ) {
				regex += ".*";
			} else if( "*".equals(starMatcher.group()) ) {
				regex += "[^/]*";
			} else {
				throw new RuntimeException("Weird match: "+starMatcher.group());
			}
			i = starMatcher.end();
		}
		regex += Pattern.quote(glob.substring(i));
		
		return new Glob(negate, Pattern.compile(regex), next);
	}