Re: [JGIT PATCH 19/22] Added the class AddRuleListFactory.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



lördagen den 10 maj 2008 15.00.37 skrev Florian Koeberle:
> +class AddRuleListFactory {
> +	/*
> +	 * The add command of git 1.5.2.5 behaves a little bit stange: "git add
> +	 * a/\*z" adds the file "a/b/xyz" but "git add a/x\*" does not.
> +	 * 
> +	 * The first is parsed as pattern "*z" for whole directory tree "a". The
> +	 * second is parsed as an path.
> +	 * 
What do *you* do?

> +	 */
> +
> +	private static List<String> getRelativePath(File projectDirectory, File file)
> +			throws PathNotInProjectDirectoryException, IOException {
> +		File currentFile = file.getCanonicalFile();
> +		final LinkedList<String> relativePath = new LinkedList<String>();
> +		while (!currentFile.equals(projectDirectory)) {
> +			relativePath.addFirst(currentFile.getName());
> +			currentFile = currentFile.getParentFile();
> +			if (currentFile == null) {
> +				throw new PathNotInProjectDirectoryException();
> +			}
> +		}
> +		return relativePath;
> +	}

Would be nice to have this logic in a utility class.

-- robin
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux