login
Header Space

 
 

Re: [JGIT PATCH v2 14/24] Added the class IgnoreRuleListFactory.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Shawn O. Pearce <spearce@...>
Cc: <git@...>
Date: Tuesday, May 13, 2008 - 6:19 am

Shawn O. Pearce wrote:
I did this to reduce complexity and to increase modularity.
The method createIgnoreRuleList(Iterable<String> lineIterable) can now 
be tested without the need to create files. Also it is so possible to 
read the patterns from different sources.

If you worry about memory usuage I could create some kind of 
RulesBuilder class:

public class RulesBuilder {
	private final List<Rule> rules;
	private RuleListToObjectConverter converter;

	// method used by tests:
	public void addIgnoreRule(String ignoreRuleLine) {
		
	}
  	public void addIgnoreRuleFile(File) {
		// reads file and calls addIgnoreRule
	}

	public void addIncludeRuleOfAddCommand(String pattern) {
	}

	public void addIgnoreGitDirectoryRule() {
	}

	public Rules buildRules() {
		return converter.convertToObject(rules);
	}
}

This would have the advantages:
* all Rule creating code at one place.
* There is no need to keep the original lines in memory.
* It's easy to create rules for testing purposes.
* It's easy to create Factories like AddRulesFactory.

If I remember correctly Intellij IDEA marks per default cases where you 
change a parameter. So it looks like that there are style guides which 
are against the practice of changing the values of parameters.

That and the fact that you can't make exclude final now where the reason 
why I wrote it the otherway.
Yes, ComplexFilePattern is about that cases only.

I implemented it that way, becasue git behave the same way:
* create the follwing file: a/a/b/test.txt
* add the line "a/b" to .gitignore
* add a and notice that it adds the test.txt file.

Ok
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [JGIT PATCH v2 04/24] Added path related constats to Con..., Florian Köberle, (Fri May 23, 11:46 am)
[JGIT PATCH v2 02/24] Formatted Repository class., Florian Koeberle, (Mon May 12, 4:13 pm)
[JGIT PATCH v2 09/24] Added the class Rule., Florian Koeberle, (Mon May 12, 4:13 pm)
[JGIT PATCH v2 08/24] Added the interface FilePattern., Florian Koeberle, (Mon May 12, 4:13 pm)
[JGIT PATCH v2 10/24] Added the iterface Rules., Florian Koeberle, (Mon May 12, 4:13 pm)
[JGIT PATCH v2 12/24] Added the class GlobalFilePattern, Florian Koeberle, (Mon May 12, 4:13 pm)
[JGIT PATCH v2 11/24] Added the class FNMatchPattern., Florian Koeberle, (Mon May 12, 4:13 pm)
Re: [JGIT PATCH v2 11/24] Added the class FNMatchPattern., Shawn O. Pearce, (Mon May 12, 8:38 pm)
[JGIT PATCH v2 19/24] Added the class AddRuleListFactory., Florian Koeberle, (Mon May 12, 4:13 pm)
Re: [JGIT PATCH v2 19/24] Added the class AddRuleListFactory., Florian Köberle, (Tue May 13, 7:24 am)
[JGIT PATCH v2 17/24] Added the class TreeFilePattern., Florian Koeberle, (Mon May 12, 4:13 pm)
Re: [JGIT PATCH v2 17/24] Added the class TreeFilePattern., Shawn O. Pearce, (Mon May 12, 9:22 pm)
[JGIT PATCH v2 20/24] Added class AddRulesFactory., Florian Koeberle, (Mon May 12, 4:13 pm)
[JGIT PATCH v2 22/24] Added class LightFileTreeIterable., Florian Koeberle, (Mon May 12, 4:13 pm)
[JGIT PATCH v2 03/24] Formatted Constats class., Florian Koeberle, (Mon May 12, 4:13 pm)
[JGIT PATCH v2 14/24] Added the class IgnoreRuleListFactory., Florian Koeberle, (Mon May 12, 4:13 pm)
Re: [JGIT PATCH v2 14/24] Added the class IgnoreRuleListFact..., Florian Köberle, (Tue May 13, 6:19 am)
[JGIT PATCH v2 13/24] Added the class ComplexFilePattern., Florian Koeberle, (Mon May 12, 4:13 pm)
speck-geostationary