]> source.dussan.org Git - jgit.git/commit
Add getConflictingNames to RefDatabase 36/9636/3
authorRobin Stocker <robin@nibor.org>
Sat, 12 Jan 2013 14:20:32 +0000 (15:20 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 6 Feb 2013 07:48:54 +0000 (08:48 +0100)
commit60d538fe5142dc1ce547a77391e4142c4fb8a251
tree1e53171fe47cf4f018acf920c4049870993aecdd
parent767be14f34b07e5acb8f332032fd97dd3e19a059
Add getConflictingNames to RefDatabase

This has the same logic as isNameConflicting, but instead of only
returning a boolean, it returns a collection of names that conflict.

It will be used in EGit to provide a better message to the user when
validating a ref name, see Ibea9984121ae88c488858b8a8e73b593195b15e0.

Existing implementations of isNameConflicting could be rewritten like
this:

  return !getConflictingNames(name).isEmpty();

But I'm not sure about that, as isNameConflicting can be implemented in
a faster way than getConflictingNames.

Change-Id: I11e0ba2f300adb8b3612943c304ba68bbe73db8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java